File: execution.xml

package info (click to toggle)
php-doc 20241205~git.dfcbb86%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 70,956 kB
  • sloc: xml: 968,269; php: 23,883; javascript: 671; sh: 177; makefile: 37
file content (47 lines) | stat: -rw-r--r-- 1,381 bytes parent folder | download
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>