I was thinking yesterday that is it possible in PHP to take input from keyboard. I started to digg and find out it is possible but no one use it because PHP was not designed to take input from keyboard :) anyway i am posting code here take a look :
#!/usr/bin/php
[php open tag]
function getinput(){
print("Your input: ");
$stdin = fopen("php://stdin", 'r');
$input = fgets($stdin, 1024);
$input = trim($input);
fclose($stdin);
return $input;
}
function output($message){
print $message."\n";
}
$message = getinput();
output($message);
[php end tag]