title: What is better to use out of in_array() and || operator?
body: <p>I am asking this question considering the performance of script. Knowing that PHP arrays don't perform very well, I am wandering which way is the best to go down when in this sort of situations.</p>
  
  <p>Suppose if <code>$x</code> equals to a or b or c or d we need <code>action_a()</code> to execute and if not <code>action_b()</code> to execute..</p>
  
  <p>We can either implement this with <code>||</code> operator as follows;</p>
  
  <pre><code>if($x == 'a' || $x == 'b' || $x == 'c' || $x == 'd'){
         action_a();
  }else{
         action_b();
  }
  </code></pre>
  
  <p>Or we can implement this using <code>in_array()</code> as follows;</p>
  
  <pre><code>if(in_array($x,array('a','b','c','d'))){
         action_a();
  }else{
         action_b();
  }
  </code></pre>
  
  <p>What I would like to know is which of these two options would perform well:</p>
  
  <ol>
  <li><p>when the number of possible values for <code>$x</code> are high?</p></li>
  <li><p>when the number of possible values for <code>$x</code> are low?</p></li>
  </ol>