|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-02-09 23:18 UTC] jimw@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 20:00:01 2025 UTC |
Hi folks. Could you add a function to a next release that reads from stdin? It would make it easier to write console scripts... A function with the same prototype of C scanf() would be great. Also, a section in the manual regarding "How to use PHP to write shell/console scripts" would be nice (it took me a whole year to figure out that I could open stdin all the time...) Currently, I use the following (do yo remember Pascal?): Function Readln(&$INPUT){ $fp = fopen("php://stdin","r"); while (!feof($fp)) { $BUFFER = fgetc($fp); $INPUT .= $BUFFER; if ($BUFFER == "\n") break; } fclose($fp); } And by the way, keep up the good job with PHP! Congratulations!