title: Why does php's in_array return true if passed a 0?
body: <p>In the below <code>in_array(0, $array)</code> evaluates to <code>true</code>. That surprised me. I expected <code>false</code>.</p>
  <p>I know adding the third parameter to indicate a strict check like <code>in_array(0, $array, true)</code> will give me the desired result.</p>
  <p>That said, I'm very curious <em>why</em> <code>in_array(0, $array)</code> evaluates to <code>true</code>. At first I thought it was just seeing a string at the 0 index, but <code>in_array(1, $array)</code> evaluates to <code>false</code> so that doesnt seem to explain it.</p>
  <h3>Example:  <a href="http://sandbox.onlinephpfunctions.com/code/ec45e8aa54704aa6ae40d8a86300f746520ed17e" rel="nofollow noreferrer">Runable fiddle here</a></h3>
  <pre><code>&lt;?php 
  
  $array = [
      'inputs',
      'app',
      'post',
      'server',
  ];
  
  echo in_array('inputs', $array) ? '&quot;inputs&quot; is in the array...' : '';
  echo &quot;\n&quot;;
  
  echo in_array(0, $array) ? '0 is also in the array!' : '';
  echo &quot;\n&quot;;
  
  echo in_array(1, $array) ? '1 is also in the array!' : '1 is NOT in the array!';
  </code></pre>
  <h3>Output:</h3>
  <pre><code>&quot;inputs&quot; is in the array...
  0 is also in the array!     &lt;---- huh? 
  1 is NOT in the array!
  </code></pre>