Checking command line argument in PHP
<p>I want to pass two different arguments to my script and based on the sent argument, I need my script does something.But I don't know how to define my conditional statement. </p>

<p>To be more precise, I want my script does searching when I pass "search" argument and alternatively showing the result when I pass "show" argument. </p>

<p>Here is my code:</p>

<pre><code>if ($argc &gt; 1) {
  if ($argv[0] == 'show') {
    for ($i = 0; $i &lt;= $argv[2]; $i++) {
      //do something
    }
  }
  elseif($argv[0] == 'search') {
    //do something
  }
} else {
  echo "no argument passed\n";
}
</code></pre>

<p>The "IF" statement is not checking my passing argument whether it is "search" or "show"</p>
