1
0
mirror of https://github.com/php/doc-en.git synced 2026-03-25 08:12:15 +01:00
Files
archived-doc-en/language/operators/execution.xml

73 lines
1.9 KiB
XML

<?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>.
</para>
<para>
<example>
<title>Backtick Operator</title>
<programlisting role="php" annotations="non-interactive">
<![CDATA[
<?php
$output = `ls -al`;
echo "<pre>$output</pre>";
?>
]]>
</programlisting>
</example>
</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="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.5.0</entry>
<entry>
The backtick operator as an alias for <function>shell_exec</function> has been deprecated.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect2>
<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>