$argv and $argc only exist if register_globals = on in CLI before 4.3.0

Closes bug #20411


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@103835 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Philip Olson 2002-11-14 11:22:58 +00:00
parent a24b52146e
commit 07b530aa58

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.11 $ -->
<!-- $Revision: 1.12 $ -->
<chapter id="features.commandline">
<title>Using PHP from the command line</title>
<!-- NEW DOCUMENTATION STARTS -->
@ -99,11 +99,26 @@
<entry><link linkend="ini.register-argc-argv">register_argc_argv</link></entry>
<entry>&true;</entry>
<entry>
The global <literal>PHP</literal> variables <literal>$argc</literal>
(number of arguments passed to the application) and
<literal>$argv</literal> (array of the actual arguments) are always
registered and filled in with the appropriate values when using the
<literal>CLI SAPI</literal>.
<para>
Because this setting is &true; you will always have access to
<emphasis>argc</emphasis> (number of arguments passed to the
application) and <emphasis>argv</emphasis> (array of the actual
arguments) in the <literal>CLI SAPI</literal>.
</para>
<para>
As of PHP 4.3.0, the <literal>PHP</literal> variables <literal>$argc</literal>
and <literal>$argv</literal> are registered and filled in with the appropriate
values when using the <literal>CLI SAPI</literal>. Before this time
the creation of these variables behaved as they do in
<literal>CGI</literal> and <literal>MODULE</literal> versions
which requires the PHP directive
<link linkend="ini.register-globals">register_globals</link> to
be <emphasis>on</emphasis>. Regardless of version or register_globals
setting you can always go through either
<link linkend="reserved.variables.server">$_SERVER</link> or
<varname>$HTTP_SERVER_VARS</varname>. Example:
<varname>$_SERVER['argv']</varname>
</para>
</entry>
</row>
</tbody>