downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the SVN repository for this website on svn.php.net.

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> &mdash; <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&#039;s filename, therefore
    <var class="varname">$argv[0]</var> is the script&#039;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">&lt;?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">?&gt;</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]=&gt;
  string(10) &quot;script.php&quot;
  [1]=&gt;
  string(4) &quot;arg1&quot;
  [2]=&gt;
  string(4) &quot;arg2&quot;
  [3]=&gt;
  string(4) &quot;arg3&quot;
}
</pre></div>
    </div>
   </div><p>
  </p>
 </div>

 
</div><?php manual_footer(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites