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.argc.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.argc.php',
   
1 => '$argc',
  ),
 
'up' =>
  array (
   
0 => 'reserved.variables.php',
   
1 => 'Predefined Variables',
  ),
 
'prev' =>
  array (
   
0 => 'reserved.variables.httpresponseheader.php',
   
1 => '$http_response_header',
  ),
 
'next' =>
  array (
   
0 => 'reserved.variables.argv.php',
   
1 => '$argv',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="reserved.variables.argc" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">$argc</h1>
  <p class="refpurpose"><span class="refname">$argc</span> &mdash; <span class="dc-title">The number of arguments passed to script</span></p>

 </div>
 
 <a name="reserved.variables.argc.description"></a><div class="refsect1 description">
  <h3 class="title">Description</h3>
  <p class="para">
   Contains the number of arguments passed to the current 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 script&#039;s filename is always passed as an argument to the script, therefore
    the minimum value of <var class="varname">$argc</var> is <i>1</i>.
   </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.argc.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">$argc</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">$argc</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>
int(4)
</pre></div>
    </div>
   </div><p>
  </p>
 </div>

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