cvs: /phpdoc/language operators.sgml /phpdoc/functions exec.sgml
| From: | Torben Wilson | Date: | Mon, 15 Nov 1999 10:03:17 +0000 |
| Subject: | cvs: /phpdoc/language operators.sgml /phpdoc/functions exec.sgml | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-12559@lists.php.net to get a copy of this message | ||
cslawi Mon Nov 15 05:03:17 1999 EDT
Modified files:
/phpdoc/language operators.sgml
/phpdoc/functions exec.sgml
Log:
Added backtick operator and some crossrefs.
Index: phpdoc/language/operators.sgml
diff -u phpdoc/language/operators.sgml:1.4 phpdoc/language/operators.sgml:1.5
--- phpdoc/language/operators.sgml:1.4 Mon Nov 15 04:32:18 1999
+++ phpdoc/language/operators.sgml Mon Nov 15 05:03:15 1999
@@ -59,19 +59,6 @@
</simpara>
--></sect1>
- <sect1 id="language.operators.string">
- <title>String Operators</title>
- <simpara>
- There is only really one string operator -- the concatenation
- operator (".").
- </simpara>
- <para>
- <informalexample><programlisting>
-$a = "Hello ";
-$b = $a . "World!"; // now $b = "Hello World!"
- </programlisting></informalexample>
- </para></sect1>
-
<sect1 id="language.operators.assignment">
<title>Assignment Operators</title>
<simpara>
@@ -110,7 +97,7 @@
up pointing at the same data, and nothing is copied anywhere.
</para>
-</sect1>
+ </sect1>
<sect1 id="language.operators.bitwise">
<title>Bitwise Operators</title>
@@ -162,60 +149,38 @@
</row>
</tbody>
</tgroup>
- </table></sect1>
+ </table>
+ </sect1>
- <sect1 id="language.operators.logical">
- <title>Logical Operators</title>
- <table>
- <title>Logical Operators</title>
- <tgroup cols="3">
- <thead>
- <row>
- <entry>example</entry>
- <entry>name</entry>
- <entry>result</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>$a and $b</entry>
- <entry>And</entry>
- <entry>True of both $a and $b are true.</entry>
- </row>
- <row>
- <entry>$a or $b</entry>
- <entry>Or</entry>
- <entry>True if either $a or $b is true.</entry>
- </row>
- <row>
- <entry>$a xor $b</entry>
- <entry>Or</entry>
- <entry>True if either $a or $b is true, but not both.</entry>
- </row>
- <row>
- <entry>! $a</entry>
- <entry>Not</entry>
- <entry>True if $a is not true.</entry>
- </row>
- <row>
- <entry>$a && $b</entry>
- <entry>And</entry>
- <entry>True of both $a and $b are true.</entry>
- </row>
- <row>
- <entry>$a || $b</entry>
- <entry>Or</entry>
- <entry>True if either $a or $b is true.</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
+ <sect1 id="language.operators.execution">
+ <title>Execution Operators</title>
+
+ <para>
+ PHP supports one execution operator: backticks (``). Note that
+ these are not single-quotes! PHP will attempt to execute the
+ contents of the backticks as a shell command; the output will be
+ returned (i.e., it won't simply be dumped to output; it can be
+ assigned to a variable).
+
+ <informalexample>
+ <programlisting role="php">
+$output =
ls -al;
+echo "<pre>$output</pre>";
+ </programlisting>
+ </informalexample>
- <simpara>
- The reason for the two different variations of "and" and "or"
- operators is that they operate at different precedences. (See below.)
- </simpara></sect1>
+ </para>
+
+ <para>
+ See also <function>system</function>,
+ <function>passthru</function>, <function>exec</function>,
+ <function>popen</function>, and
+ <function>escapeshellcmd</function>.
+ </para>
+
+ </sect1>
+
<sect1 id="language.operators.comparison">
<title>Comparison Operators</title>
@@ -225,7 +190,7 @@
</simpara>
<table>
- <title>Comparson Operators</title>
+ <title>Comparison Operators</title>
<tgroup cols="3">
<thead>
<row>
@@ -275,8 +240,64 @@
<informalexample><programlisting>(expr1) ? (expr2) :
(expr3);</programlisting></informalexample>
This expression returns to <replaceable>expr2</replaceable> if
<replaceable>expr1</replaceable> evalutes to true, and expr3 if
- <replaceable>expr1</replaceable> evaluates to false.</para></sect1>
+ <replaceable>expr1</replaceable> evaluates to false.
+ </para>
+ </sect1>
+
+
+ <sect1 id="language.operators.logical">
+ <title>Logical Operators</title>
+ <table>
+ <title>Logical Operators</title>
+ <tgroup cols="3">
+ <thead>
+ <row>
+ <entry>example</entry>
+ <entry>name</entry>
+ <entry>result</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>$a and $b</entry>
+ <entry>And</entry>
+ <entry>True of both $a and $b are true.</entry>
+ </row>
+ <row>
+ <entry>$a or $b</entry>
+ <entry>Or</entry>
+ <entry>True if either $a or $b is true.</entry>
+ </row>
+ <row>
+ <entry>$a xor $b</entry>
+ <entry>Or</entry>
+ <entry>True if either $a or $b is true, but not both.</entry>
+ </row>
+ <row>
+ <entry>! $a</entry>
+ <entry>Not</entry>
+ <entry>True if $a is not true.</entry>
+ </row>
+ <row>
+ <entry>$a && $b</entry>
+ <entry>And</entry>
+ <entry>True of both $a and $b are true.</entry>
+ </row>
+ <row>
+ <entry>$a || $b</entry>
+ <entry>Or</entry>
+ <entry>True if either $a or $b is true.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <simpara>
+ The reason for the two different variations of "and" and "or"
+ operators is that they operate at different precedences. (See below.)
+ </simpara></sect1>
+
<sect1 id="language.operators.precedence">
<title>Operator Precedence</title>
<para>
@@ -382,6 +403,21 @@
</tbody>
</tgroup>
</table></para></sect1>
+
+ <sect1 id="language.operators.string">
+ <title>String Operators</title>
+ <simpara>
+ There is only really one string operator -- the concatenation
+ operator (".").
+ </simpara>
+ <para>
+ <informalexample><programlisting>
+$a = "Hello ";
+$b = $a . "World!"; // now $b = "Hello World!"
+ </programlisting></informalexample>
+ </para>
+ </sect1>
+
</chapter>
Index: phpdoc/functions/exec.sgml
diff -u phpdoc/functions/exec.sgml:1.3 phpdoc/functions/exec.sgml:1.4
--- phpdoc/functions/exec.sgml:1.3 Wed Oct 20 18:41:42 1999
+++ phpdoc/functions/exec.sgml Mon Nov 15 05:03:16 1999
@@ -14,17 +14,28 @@
<paramdef>string <parameter>command</parameter></paramdef>
</funcsynopsis>
<para>
- <function>EscapeShellCmd</function> escapes any characters in a string that
- might be used to trick a shell command into executing arbitrary commands.
- This function should be used to make sure that any data coming from user
- input is escaped before this data is passed to the <function>exec</function> or
<function>system</function>
- functions. A standard use would be:</para>
+ <function>EscapeShellCmd</function> escapes any characters in a
+ string that might be used to trick a shell command into executing
+ arbitrary commands. This function should be used to make sure
+ that any data coming from user input is escaped before this data
+ is passed to the <function>exec</function> or
+ <function>system</function> functions, or to the <link
+ linkend="language.operators.execution">backtick
+ operator</link>. A standard use would be:</para>
<para>
<informalexample>
<programlisting>
system(EscapeShellCmd($cmd))
</programlisting>
- </informalexample></para>
+ </informalexample>
+ </para>
+
+ <para>
+ See also <function>exec</function>, <function>popen</function>,
+ <function>system</function>, and the <link
+ linkend="language.operators.execution">backtick operator</link>.
+ </para>
+
</refsect1>
</refentry>
@@ -62,9 +73,13 @@
Note that if you are going to allow data coming from user input to be
passed to this function, then you should be using
<function>EscapeShellCmd</function>
to make sure that users cannot trick the system into executing arbitrary commands.</para>
+
<para>
- See also <function>system</function>, <function>PassThru</function>,
- <function>popen</function> and
<function>EscapeShellCmd</function>.</para>
+ See also <function>system</function>,
+ <function>PassThru</function>, <function>popen</function>,
+ <function>EscapeShellCmd</function>, and the <link
+ linkend="language.operators.execution">backtick operator</link>.
+ </para>
</refsect1>
</refentry>
@@ -95,7 +110,14 @@
<para>
If you need to execute a command and have all the data from the command passed
directly back without any interference, use the <function>PassThru</function>
- function. See also the <function>exec</function> and
<function>popen</function> functions.</para>
+ function.
+ </para>
+ <para>
+ See also <function>exec</function>,
+ <function>PassThru</function>, <function>popen</function>,
+ <function>EscapeShellCmd</function>, and the <link
+ linkend="language.operators.execution">backtick operator</link>.
+ </para>
</refsect1>
</refentry>
@@ -126,7 +148,11 @@
then calling a pbmplus program to output a gif, you can create
PHP scripts that output images directly.</para>
<para>
- See also <function>exec</function> and
<function>fpassthru</function>.</para>
+ See also <function>exec</function>,
+ <function>PassThru</function>, <function>popen</function>,
+ <function>EscapeShellCmd</function>, and the <link
+ linkend="language.operators.execution">backtick operator</link>.
+ </para>
</refsect1>
</refentry>