title: PHP is_null: Only boolean true and false, not even null?
body: <p>Following up on this <a href="https://stackoverflow.com/questions/12461146/php-filter-var-how-to-make-sure-the-user-provides-correct-data-types-true-or">question and answer</a>, I decided to accept boolean true and false only, and <strong>not</strong> even <code>null</code> from the input by other developer/ user.</p>
  
  <pre><code>$default = array(
      "category_id"   =&gt;  null,
      "category"      =&gt;  false,
      "randomise"     =&gt;  false
  );
  
  $config = array(
      "category_id"   =&gt;  17,
      "randomise"     =&gt;  false, 
      "category"      =&gt;  null
  );
  
  function process_array($default,$config)
  {
      # Set empty arrays for error &amp; items.
      $error = array();
      $items = array();
  
      # Loop the array.
      foreach($default as $key =&gt; $value)
      {
          if (is_bool($default[$key]) &amp;&amp; isset($config[$key])) 
          {
              if ($config[$key] === null) $error[] = '"'. $key.'" cannot be null.';
  
              # Make sure that the value of the key is a boolean.
              if (!is_bool($config[$key])) 
              {
                  $error[] = '"'. $key.'" can be boolean only.';
              }
  
          }
  
              if(isset($config[$key]) &amp;&amp; !is_array($value))
              {
                  $items[$key] = $config[$key];
              }
              elseif(isset($config[$key]) &amp;&amp; is_array($value))
              {
                  $items[$key] = array_merge($default[$key], $config[$key]);
              }
              else
              {
                  $items[$key] = $value;
              }
          }
  
          # Give a key to the error array.
          $error = array("error" =&gt; $error);
  
          # Merge the processed array with error array.
          # Return the result.
          return array_merge($items,$error);
  }
  
  print_r(process_array($default,$config));
  </code></pre>
  
  <p>but result I get is,</p>
  
  <pre><code>Array
  (
      [category_id] =&gt; 17
      [category] =&gt; 
      [randomise] =&gt; 
      [error] =&gt; Array
          (
          )
  
  )
  </code></pre>
  
  <p>the result I am after,</p>
  
  <pre><code>Array
  (
      [category_id] =&gt; 17
      [category] =&gt; 
      [randomise] =&gt; 
      [error] =&gt; Array
          (
           [0] =&gt; "category" cannot be null.
          )
  
  )
  </code></pre>
  
  <p>So I thought this line below should work, but I don't understand why it doesn't. I tried to use <code>is_null</code> but still not working. Any idea what have I done wrong and how can I fix this?</p>
  
  <pre><code>if ($config[$key] === null) $error[] = '"'. $key.'" cannot be null.';
  </code></pre>