Re: additional example for CLI

From: Date: Sun, 05 Jan 2003 13:05:56 +0000
Subject: Re: additional example for CLI
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969350703@lists.php.net to get a copy of this message
Please submit this as a Documentation problem at bugs.php.net so we won't forget it, and can discuss it as a bug report... Thanks, Goba ----- Original Message ----- From: "Andrey Hristov" <andrey@webgate.bg> To: <phpdoc@lists.php.net> Sent: Sunday, January 05, 2003 2:05 PM Subject: [PHP-DOC] additional example for CLI > Hi, > few minutes ago I was asked by a friend : > "How can I read the user input in CLI?" > He proposed this : > > <?php > print "enter:\n"; > $r = fread(STDIN, 100); > print $r; > ?> > > but....the user has to enter EOF (Ctrl-Z on Windows, Ctrl-D on *nix). This > is not intuitive. > So after some thinking I created this : > > <?php > print "enter:\n"; > fscanf($STDIN, "%d\n",$r); //reading a number > print $r; > ?> > > I haven't found an example about that issue on the CLI SAPI page. > > Thanks, > Andrey > > > -- > PHP Documentation Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.doc (#969350703) next »