mfischer                Thu Jun  6 14:36:45 2002 EDT

  Modified files:              
    /phpdoc/en/features commandline.xml 
  Log:
  - Sync with latest commits to php_cgi.c .
  
  
Index: phpdoc/en/features/commandline.xml
diff -u phpdoc/en/features/commandline.xml:1.5 phpdoc/en/features/commandline.xml:1.6
--- phpdoc/en/features/commandline.xml:1.5      Thu May 16 16:52:38 2002
+++ phpdoc/en/features/commandline.xml  Thu Jun  6 14:36:45 2002
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.5 $ -->
+<!-- $Revision: 1.6 $ -->
 <chapter id="features.commandline">
  <title>Using PHP from the command line</title>
  <!-- NEW DOCUMENTATION STARTS -->
@@ -109,6 +109,65 @@
       e.g. <link linkend="ini.register-argc-argv">register_argc_argv</link>).
      </para>
     </note>
+   </listitem>
+   <listitem>
+    <para>
+     The ease the operating in the shell environment, the following constants
+     are defined:
+     <table>
+      <title>CLI specific Constants</title>
+      <tgroup cols="2">
+       <thead>
+        <row>
+         <entry>Constant</entry>
+         <entry>Description</entry>
+        </row>
+       </thead>
+       <tbody>
+        <row>
+         <entry><constant>STDIN</constant></entry>
+         <entry>
+         An already opened stream to <literal>stdin</literal>. This saves
+         opening it with
+         <programlisting role="php">
+$stdin = fopen('php://stdin', 'r');
+         </programlisting>
+         </entry>
+        </row>
+        <row>
+         <entry><constant>STDOUT</constant></entry>
+         <entry>
+         An already opened stream to <literal>stdout</literal>. This saves
+         opening it with
+         <programlisting role="php">
+$stdout = fopen('php://stdout', 'w');
+         </programlisting>
+         </entry>
+        </row>
+        <row>
+         <entry><constant>STDERR</constant></entry>
+         <entry>
+         An already opened stream to <literal>stdout</literal>. This saves
+         opening it with
+         <programlisting role="php">
+$stderr = fopen('php://stderr', 'w');
+         </programlisting>
+         </entry>
+        </row>
+       </tbody>
+      </tgroup>
+     </table>
+    </para>
+    <para>
+     Given the above, you don't need to open e.g. a stream for
+     <literal>stderr</literal> yourself but simply use the constant instead of
+     the stream resource:
+     <programlisting role="php">
+php -r 'fwrite(STDERR, "stderr\n");'
+     </programlisting>
+     You do not need to explicitely close these streams, this is automatically
+     done by <literal>PHP</literal>.
+    </para>
    </listitem>
    <listitem>
     <para>


Reply via email to