PHP 4.0 Bug #8515: Add function to read from stdin

From: Date: Tue, 02 Jan 2001 14:47:04 +0000
Subject: PHP 4.0 Bug #8515: Add function to read from stdin
Groups: php.dev 
Request: Send a blank email to php-dev+get-42594@lists.php.net to get a copy of this message
From: ptuasca@hotmail.com Operating system: All PHP version: 4.0.4 PHP Bug Type: Feature/Change Request Bug description: Add function to read from stdin 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! -- Edit Bug report at: http://bugs.php.net/?id=8515&edit=1

« previous php.dev (#42594) next »