1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
<?xml version="1.0" encoding="utf-8"?>
<sect1 xml:id="language.operators.execution">
<title>Execution Operators</title>
<titleabbrev>Execution</titleabbrev>
<para>
PHP supports one execution operator: backticks (<literal>``</literal>). 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). Use of the backtick operator is identical
to <function>shell_exec</function>.
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
$output = `ls -al`;
echo "<pre>$output</pre>";
?>
]]>
</programlisting>
</informalexample>
</para>
<note>
<para>
The backtick operator is disabled when
<function>shell_exec</function> is disabled.
</para>
</note>
<note>
<para>
Unlike some other languages, backticks have no special meaning
within double-quoted strings.
</para>
</note>
<sect2 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><link linkend="ref.exec">Program Execution functions</link></member>
<member><function>popen</function></member>
<member><function>proc_open</function></member>
<member><link linkend="features.commandline">Using PHP from the commandline</link></member>
</simplelist>
</para>
</sect2>
</sect1>
|