title: array_diff_key catchable fatal error: Object of class stdClass could not be converted to string?
body: <p><strong>VOTE TO CLOSE. COMPLETLY MISSPELLED METHOD. THANKS AND SORRY FOR BOTHER.</strong></p>
  
  <p>I'm getting an error <code>array_diff_key</code>to an array of objects. Is this a bug or something? This isn't supposed to happen:</p>
  
  <pre><code>array array_diff_key ( array $array1 , array $array2 [, array $... ] )
  </code></pre>
  
  <blockquote>
    <p>Compares the keys from array1 against the keys from array2 and returns
    the difference. This function is like array_diff() except the
    comparison is done on the keys instead of the values.</p>
  </blockquote>
  
  <pre><code>echo "all:";
  var_dump($all);
  echo "filtered:"
  var_dump($filtered);
  $not_valid = array_diff_key($all, $filtered);
  
  all:
  array
    1 =&gt; 
      object(stdClass)[11]
    2 =&gt; 
      object(stdClass)[6]
    3 =&gt; 
      object(stdClass)[12]
    4 =&gt; 
      object(stdClass)[10]
  
  filtered:
  array
    1 =&gt; 
      object(stdClass)[11]
    3 =&gt; 
      object(stdClass)[12]
    4 =&gt; 
      object(stdClass)[10]
  </code></pre>
  
  <p><strong>Result</strong>:</p>
  
  <blockquote>
    <p>Catchable fatal error: Object of class stdClass could not be converted
    to string.</p>
  </blockquote>
  
  <p><strong>EDIT</strong>: a simple example that actually works using <code>sdtClass</code> (so.. why my code above isn't working?):</p>
  
  <pre><code>$all = array(
      1 =&gt; (object) array('name' =&gt; 'Apple'),
      2 =&gt; (object) array('name' =&gt; 'Banana'),
      3 =&gt; (object) array('name' =&gt; 'Meat'),
  );
  
  $animal = array(3 =&gt; (object) array('name' =&gt; 'Meat'));
  $vegetable = array_diff_key($all, $animal);
  
  var_dump($vegetable);
  </code></pre>
  
  <p><strong>EDIT 2</strong>: if matters, this is how actually <code>$all</code> array is built (<code>$all = fetchHeaders()</code>):</p>
  
  <pre><code>$all = fetchHeaders();
  array_diff_assoc($all, array(1 =&gt; new stdClass())) // Fatal error
  
  public function fetchHeaders()
  {
      $retval = array();
      $last = @imap_num_msg($this-&gt;conn);
  
      for ($i = 1; $i &lt;= $last; $i++)
      {
          $header = @imap_header($this-&gt;conn, $i);
          $uid    = @imap_uid($this-&gt;conn, intval(trim($header-&gt;Msgno)));
          $parsed =  MIMEParser::decodeHeader($header);
          if($parsed) $retval[$uid] = $parsed;
      }
      return $retval;
  }
  
  public static function decodeHeader($header)
  {
      $person  = isset($header-&gt;from[0]-&gt;personal) ?
           trim($header-&gt;from[0]-&gt;personal) : null;
      $subject = isset($header-&gt;subject) ? trim($header-&gt;subject) : null;
  
      $retval = array(
          'date'    =&gt; $header-&gt;udate,
          'from'    =&gt; $header-&gt;from[0]-&gt;mailbox . '@' . $header-&gt;from[0]-&gt;host,
          'person'  =&gt; !empty($person) ? $person : null,
          'to'      =&gt; $header-&gt;to[0]-&gt;mailbox . '@' . $header-&gt;to[0]-&gt;host,
          'subject' =&gt; !empty($subject) ? $subject : null,
      );
      return (object) $retval;
  }
  </code></pre>