vrana           Tue Jul 27 09:40:02 2004 EDT

  Modified files:              
    /phpdoc/en/features commandline.xml 
  Log:
  Example for reading data (bug #21428)
  
http://cvs.php.net/diff.php/phpdoc/en/features/commandline.xml?r1=1.32&r2=1.33&ty=u
Index: phpdoc/en/features/commandline.xml
diff -u phpdoc/en/features/commandline.xml:1.32 phpdoc/en/features/commandline.xml:1.33
--- phpdoc/en/features/commandline.xml:1.32     Sat May 22 04:52:07 2004
+++ phpdoc/en/features/commandline.xml  Tue Jul 27 09:40:02 2004
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.32 $ -->
+<!-- $Revision: 1.33 $ -->
 <chapter id="features.commandline">
  <title>Using PHP from the command line</title>
  <!-- NEW DOCUMENTATION STARTS -->
@@ -230,6 +230,16 @@
 
 $stdin = fopen('php://stdin', 'r');
 
+?>
+]]>
+         </programlisting>
+         If you want to read single line from <literal>stdin</literal>, you can
+         use
+         <programlisting role="php">
+<![CDATA[
+<?php
+$line = trim(fgets(STDIN)); // reads one line from STDIN
+fscanf(STDIN, "%d\n", $number); // reads number from STDIN
 ?>
 ]]>
          </programlisting>

Reply via email to