Get user input on the command line (Windows only)
There is a code to get user input on ‘*nix’, now there is a code to do the same on Windows based system. Put this code in a file, for example input.php and run it with ‘php -f input.php’
<?php
function read() {
$fp=fopen(”con”, “rb”);
$input=fgets($fp, 255);
fclose($fp);
return str_replace(”rn”, “”, $input);
}
echo(”Whats your name? “);
$name = read();
echo(”Hello $name!n”);
?>
