Source of: /manual/en/reserved.variables.argv.php
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/reserved.variables.inc";
$setup = array (
'home' =>
array (
0 => 'index.php',
1 => 'PHP Manual',
),
'head' =>
array (
0 => 'UTF-8',
1 => 'en',
),
'this' =>
array (
0 => 'reserved.variables.argv.php',
1 => '$argv',
),
'up' =>
array (
0 => 'reserved.variables.php',
1 => 'Predefined Variables',
),
'prev' =>
array (
0 => 'reserved.variables.argc.php',
1 => '$argc',
),
'next' =>
array (
0 => 'reserved.exceptions.php',
1 => 'Predefined Exceptions',
),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);
manual_header();
?>
<div id="reserved.variables.argv" class="refentry">
<div class="refnamediv">
<h1 class="refname">$argv</h1>
<p class="refpurpose"><span class="refname">$argv</span> — <span class="dc-title">Array of arguments passed to script</span></p>
</div>
<a name="reserved.variables.argv.description"></a><div class="refsect1 description">
<h3 class="title">Description</h3>
<p class="para">
Contains an <a href="language.types.array.php" class="type array">array</a> of all the arguments passed to the script when running
from the <a href="features.commandline.php" class="link">command line</a>.
</p>
<blockquote><p><b class="note">Note</b>:
<span class="simpara">
The first argument is always the current script's filename, therefore
<var class="varname">$argv[0]</var> is the script's name.
</span>
</p></blockquote>
<blockquote><p><b class="note">Note</b>:
<span class="simpara">
This variable is only available when <a href="ini.core.php#ini.register-argc-argv" class="link">register_argc_argv</a>
is enabled.
</span>
</p></blockquote>
</div>
<a name="reserved.variables.argv.examples"></a><div class="refsect1 examples">
<h3 class="title">Examples</h3>
<p class="para">
</p><div class="example">
<p><b>Example #1 <var class="varname">$argv</var> example</b></p>
<div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB"><?php<br />var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$argv</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span>
</span>
</code></div>
</div>
<div class="example-contents simpara"><p>
When executing the example with: php script.php arg1 arg2 arg3
</p></div>
<div class="example-contents para"><p>The above example will output
something similar to:</p></div>
<div class="example-contents screen">
<div class="cdata"><pre>
array(4) {
[0]=>
string(10) "script.php"
[1]=>
string(4) "arg1"
[2]=>
string(4) "arg2"
[3]=>
string(4) "arg3"
}
</pre></div>
</div>
</div><p>
</p>
</div>
</div><?php manual_footer(); ?>