+ 3
How to get user input in php?
5 Answers
+ 3
but it cause an error
+ 2
Whats the error?
+ 2
From http://php.net/manual/en/function.readline.php :
The readline library is not available on Windows.
Try:
<?php
if (PHP_OSÂ ==Â 'WINNT') {
 echo '$ ';
  $line = stream_get_line(STDIN, 1024, PHP_EOL);
} else {
  $line = readline('$ ');
}
?>
Other Solutions at same URL.
By the way, SL interpreter runs on Windows Server 2012; as usual, you can get all infoes about PHP environment using phpinfo()
+ 2
By the way, you get user input from CLI.
For the task Shruthi suggested, use a form and manage $_POST array:
https://www.w3schools.com/php/php_forms.asp