title: PHP - command line arguments in Windows
body: <p>I'm trying to run PHP from the command line under <a href="https://en.wikipedia.org/wiki/Windows_XP" rel="nofollow noreferrer">Windows XP</a>.</p>
  <p>That works, except for the fact that I am not able to provide parameters to my PHP script.</p>
  <p>My test case:</p>
  <pre><code>echo &quot;param = &quot; . $param . &quot;\n&quot;;
  var_dump($argv);
  </code></pre>
  <p>I want to call this as:</p>
  <pre><code>php.exe -f test.php -- param=test
  </code></pre>
  <p>But I never get the script to accept my parameter.</p>
  <p>The result I get from the above script:</p>
  <blockquote>
  <p>PHP Notice:  Undefined variable: param in C:\test.php on line 2</p>
  </blockquote>
  <pre><code>param = ''
  array(2) {
    [0]=&gt; string(8) &quot;test.php&quot;
    [1]=&gt; string(10) &quot;param=test&quot;
  }
  </code></pre>
  <p>I am trying this using PHP 5.2.6. Is this a bug in PHP 5?</p>
  <p>The parameter passing is handled in the <a href="http://us3.php.net/features.commandline" rel="nofollow noreferrer">online help</a>:</p>
  <blockquote>
  <p>Note: If you need to pass arguments to your scripts you need to pass -- as the first argument when using the -f switch.</p>
  </blockquote>
  <p>This seemed to be working under PHP 4, but not under PHP 5.</p>
  <p>Under PHP 4 I could use the same script that could run on the server without alteration on the command line. This is handy for local debugging, for example, saving the output in a file, to be studied.</p>