Here is a an extract from some code...
Note that if you want to read more then
one thing from the user, you better not
close STDIN, cause you can only open it once.
Here's the code it may not work without 
some fixing... dunno:

-? php 
function Readln(&$INPUT){ 
    //  $fp = fopen("php://stdin","r"); 
      while (!feof(STDIN)) { 
        $BUFFER = fgetc(STDIN); 
        $INPUT .= $BUFFER; 
        if ($BUFFER == "\n") 
    //  fclose($fp);

## Don't time out in interactive console mode.

define ("STDIN", fopen("php://stdin","r"));
## Make STDIN a global thing.

While (1)
        $UserInput = preg_replace("/\n/","",$UserInput);
        $UserInput = preg_replace("/\r/","",$UserInput);
        switch (strtolower($UserInput)) {
         case "exit":
         case "quit": 
           echo "goodbye!";
           break 2; // exit switch and main loop
         /* do some other stuff ... */
fclose (STDIN);


Northern.CA ===-- 
Canada's Search Engine

PHP General Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to