Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 11032

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!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>Array of arguments passed to script</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="reserved.variables.argc.html">$argc</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="reserved.exceptions.html">Predefined Exceptions</a></div>
 <div class="up"><a href="reserved.variables.html">Predefined Variables</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="reserved.variables.argv" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">$argv</h1>
  <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">$argv</span> &mdash; <span class="dc-title">Array of arguments passed to script</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-reserved.variables.argv-description">
  <h3 class="title">Description</h3>
  <p class="para">
   Contains an <span class="type"><a href="language.types.array.html" class="type array">array</a></span> of all the arguments passed to the script when running
   from the <a href="features.commandline.html" class="link">command line</a>.
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <span class="simpara">
    The first argument <var class="varname"><var class="varname">$argv[0]</var></var> is always the name that was
    used to run the script.
   </span>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <span class="simpara">
    This variable is not available when <a href="ini.core.html#ini.register-argc-argv" class="link">register_argc_argv</a>
    is disabled.
   </span>
  </p></blockquote>
 </div>

 
 <div class="refsect1 examples" id="refsect1-reserved.variables.argv-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="variable.argv.basic">
    <p><strong>Example #1 <var class="varname"><var class="varname">$argv</var></var> example</strong></p>
    <div class="example-contents">
<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"><p>
     When executing the example with: php script.php arg1 arg2 arg3
    </p></div>
    <div class="example-contents"><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>
 </div>

 
 <div class="refsect1 seealso" id="refsect1-reserved.variables.argv-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"> <span class="function"><a href="function.getopt.html" class="function" rel="rdfs-seeAlso">getopt()</a> - Gets options from the command line argument list</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="reserved.variables.argc.html">$argc</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="reserved.exceptions.html">Predefined Exceptions</a></div>
 <div class="up"><a href="reserved.variables.html">Predefined Variables</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>