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]
Tuesday, April 12, 2011
Subscribe to:
Comments (Atom)
list open ports and unix sockets
To do this I use netstat command to list all open ports: $ sudo netstat -tuplen to list open ports and unix sockets: $ sudo netstat -...
-
This is very unconventional but a valid code and it will run!!, the magic is the static initializer block. this block is hidden from ever...
-
Original post by imdeemvp [http://forums.fedoraforum.org/showthread.php?t=25880] [small modification by me :)] To update system. Updat...