View Single Post
Old 02-15-2005, 08:15 PM   #8 (permalink)
technobard
Centurion Nova Prime
 
technobard's Avatar
 
Join Date: May 2002
Location: Oak Park, IL (USA)
Posts: 285
technobard is on a distinguished road
sde, it occurred to me that you only have to intercept stdin to add user input functionality. I found this in a quick search:
Code:
<?php 

function read($len = 255) { 
    $fp=fopen('php://stdin', 'r'); 
    $input=fgets($fp, $len); 
    fclose($fp); 
    return str_replace(array("\r", "\n"), array('', ''), $input); 

} 

echo("Whats your name? "); 
$name = read(); 
echo("Hello $name!\n");

?>
The original link is: PHP User Input Example
It's supposed to be cross platform.
__________________
It takes 2 points to draw a straight line, but at least 3 points to draw a conclusion.
technobard is offline   Reply With Quote