You can use readline function. But if you search for array input then you have to also use explode function. See given example for get array input,
<?php
//input 1 6 5
$a = explode(' ', readline()); //read array
for($i=0;$i<sizeof($a);$i++)
{
echo $a[$i]." ";
}
?>
Output:
1 6 5
Using fscanf() function works same as the fscanf() function in C. We can read 2 integers from Keyboard(STDIN) as below:
This is defferent from the previous method
<?php
// Input 1 5
fscanf(STDIN, "%d %d", $a, $b);
// Output
// The sum of 1 and 5 is 6
echo "The sum of " . $a . " and "
. $b . " is " . ($a + $b);
?>
Output:
The sum of 1 and 5 is 6
For more example Link