<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Execution Operators</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="language.operators.errorcontrol.html">Error Control Operators</a></div> <div class="next" style="text-align: right; float: right;"><a href="language.operators.increment.html">Incrementing/Decrementing Operators</a></div> <div class="up"><a href="language.operators.html">Operators</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="language.operators.execution" class="sect1"> <h2 class="title">Execution Operators</h2> <p class="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). Use of the backtick operator is identical to <span class="function"><a href="function.shell-exec.html" class="function">shell_exec()</a></span>. <div class="informalexample"> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br />$output </span><span style="color: #007700">= `</span><span style="color: #DD0000">ls -al</span><span style="color: #007700">`;<br />echo </span><span style="color: #DD0000">"<pre></span><span style="color: #0000BB">$output</span><span style="color: #DD0000"></pre>"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> </p> <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para"> The backtick operator is disabled when <a href="ini.sect.safe-mode.html#ini.safe-mode" class="link">safe mode</a> is enabled or <span class="function"><a href="function.shell-exec.html" class="function">shell_exec()</a></span> is disabled. </p> </p></blockquote> <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para"> Unlike some other languages, backticks cannot be used within double-quoted strings. </p> </p></blockquote> <p class="para"> See also the manual section on <a href="ref.exec.html" class="link">Program Execution functions</a>, <span class="function"><a href="function.popen.html" class="function">popen()</a></span> <span class="function"><a href="function.proc-open.html" class="function">proc_open()</a></span>, and <a href="features.commandline.html" class="link">Using PHP from the commandline</a>. </p> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="language.operators.errorcontrol.html">Error Control Operators</a></div> <div class="next" style="text-align: right; float: right;"><a href="language.operators.increment.html">Incrementing/Decrementing Operators</a></div> <div class="up"><a href="language.operators.html">Operators</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>