title: in_array() doesn't work as expected with associative array
body: <p>I don't know what's causing this issue, but I'll post the code below then go through what I've done so far and the results I've gotten.</p>
  
  <pre><code>$client_emails = array(
      'email@ex-one.com' =&gt; null, // first array entry
      'email@ex-two.com'   =&gt; 'page_two',
      'email@ex-three.com' =&gt; 'page_three',
      'email@ex-four.com' =&gt; null,
  );
  
  $form_email = 'email@ex-two.com';
  
  
  if (!empty($form_email)) {
      if (isset($client_emails[$form_email])) {
           $client_page = $client_emails[$form_email];
      } else { $client_page = null; }
  }
  
  if (in_array($form_email, $client_emails)) {
   if (!is_null($client_page)) {
       echo 'All seems to be good! - ';
       echo $client_page;
   } else {
       echo 'You can not be here.';
   }
  } else {
       echo "For some reason this isn't working... 'in_array' should be finding the email in the array.";
  }
  </code></pre>
  
  <p>The above code is what I've been playing with, it does not work. It will work, however, if we change the value for the <code>'first array entry' (comment)</code> from <code>NULL</code> to <code>TRUE</code>, like so:</p>
  
  <pre><code>$client_emails = array(
      'email@ex-one.com' =&gt; true, // first array entry
      'email@ex-two.com'   =&gt; 'page_two',
      'email@ex-three.com' =&gt; 'page_three',
      'email@ex-four.com' =&gt; null,
  );
  </code></pre>
  
  <p>The whole thing technically works now, but <code>TRUE</code> is equal to <code>1</code> and now the rest of my script does not work properly because it will read that as a value of <code>1</code> and echo it. I need it to be <code>NULL</code>.</p>
  
  <p>The <code>'first array entry'</code> cannot be <code>NULL</code> or <code>FALSE</code>, the only value that works is <code>TRUE</code>. It can be empty IF the value for <code>$form_email</code> is equal to a key that does not have a value, if the key has a value and there is no value of <code>TRUE</code> for the first array key then the whole thing fails any ways.</p>
  
  <p><a href="http://sandbox.onlinephpfunctions.com/code/6d5a145fded531320742cd25803a2ab6079608cf" rel="nofollow"><kbd><strong>Code to reproduce the issue</strong></kbd></a></p>
  
  <p>I don't understand what's happening. I have two questions:</p>
  
  <ol>
  <li>Any suggestions on how to get around this? </li>
  <li>If you could help me understand why this is happening -- maybe I'm doing something wrong?</li>
  </ol>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I've also tried the following:</p>
  
  <pre><code>$client_emails = array(
      'email@ex-one.com' =&gt; 'null', // first array entry
      'email@ex-two.com'   =&gt; 'page_two',
      'email@ex-three.com' =&gt; 'page_three',
      'email@ex-four.com' =&gt; 'null',
  );
  
  $form_email = 'email@ex-two.com';
  
  
  if (!empty($form_email)) {
      if (isset($client_emails[$form_email])) {
           $client_page = $client_emails[$form_email];
      } else { $client_page = null; }
  }
  
  if (in_array($form_email, $client_emails)) {
   if (!empty($client_page) &amp;&amp; $client_page != 'null') {
       echo 'All seems to be good! - ';
       echo $client_page;
   } else {
       echo 'You can not be here.';
   }
  } else {
       echo "For some reason this isn't working... 'in_array' should be finding the email in the array.";
  }
  </code></pre>