Re: Read a var from stdin
| From: | Miguel Cruz | Date: | Sun, 19 May 2002 05:38:36 +0000 |
| Subject: | Re: Read a var from stdin | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-98337@lists.php.net to get a copy of this message | ||
On Sat, 18 May 2002, Rafael Perazzo wrote:
> Is there any way to ask the user to type the value of
> a variable from stdin ? (like read in Pascal, or scanf
> in C). I'm using PHP from command line.
<?
$f = fopen('php://stdin', 'r'); // this line answers your question
while ($l = fgets($f, 100)) print strtoupper($l);
fclose($f);
?>
miguel