Date: 01/05/03
- Next message: axel_kollmorgen <email protected>: "[PHP-DOC] #14499 [Com]: encoding with XSLT problem"
- Previous message: nicos <email protected>: "[PHP-DOC] #21428 [Opn]: additional example for CLI SAPI page"
- In reply to: andrey <email protected>: "[PHP-DOC] #21428 [NEW]: additional example for CLI SAPI page"
- Next in thread: philip <email protected>: "[PHP-DOC] #21428 [Opn]: additional example for CLI SAPI page"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ID: 21428
Updated by: andrey <email protected>
Reported By: andrey <email protected>
Status: Open
Bug Type: Documentation problem
Operating System: all
PHP Version: 4.3.0
New Comment:
I completely agree.
fscanf() is for advanced users but one example with fgets() and
fscanf() will be better IMHO.
Previous Comments:
------------------------------------------------------------------------
[2003-01-05 07:21:27] nicos <email protected>
Note: there should be an another one with fgets() IMHO.
------------------------------------------------------------------------
[2003-01-05 07:11:40] andrey <email protected>
sorry
STDIN instead of $STDIN
------------------------------------------------------------------------
[2003-01-05 07:08:31] andrey <email protected>
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
------------------------------------------------------------------------
-- Edit this bug report at http://bugs.php.net/?id=21428&edit=1-- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: axel_kollmorgen <email protected>: "[PHP-DOC] #14499 [Com]: encoding with XSLT problem"
- Previous message: nicos <email protected>: "[PHP-DOC] #21428 [Opn]: additional example for CLI SAPI page"
- In reply to: andrey <email protected>: "[PHP-DOC] #21428 [NEW]: additional example for CLI SAPI page"
- Next in thread: philip <email protected>: "[PHP-DOC] #21428 [Opn]: additional example for CLI SAPI page"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

