Re: [PHP] Read a var from stdin

2002-05-20 Thread Analysis Solutions

On Sun, May 19, 2002 at 12:38:36AM -0500, Miguel Cruz wrote:
 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

Just in case Rafael is asking about how to read items put into the 
command line, use the $argv array.

Enjoy,

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Read a var from stdin

2002-05-18 Thread Rafael Perazzo

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. 

Thanks 

Rafael Perazzo

__
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Read a var from stdin

2002-05-18 Thread Miguel Cruz

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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php