title: How can I get an object "key" from the value? Is there something like array_search for objects?
body: <p>I have a class like so:</p>
  
  <pre><code>stdClass Object
  (
      [id] =&gt; 1
      [items] =&gt; stdClass Object
          (
              [0] =&gt; 123
              [1] =&gt; 234
              [2] =&gt; 345
              [3] =&gt; 456
          )
      )
  )
  </code></pre>
  
  <p>Let's call the above object <code>$foo</code>.</p>
  
  <p>Let's say <code>$v = 234</code>.  Given <code>$foo</code> and <code>$v</code>, how can I return the "key" <code>1</code>?</p>
  
  <p>If <code>$foo-&gt;items</code> was an array I would simply do <code>$key = array_search($v,$foo-&gt;items);</code>.  But this doesn't work in an object.</p>
  
  <p>How can I find the key for <code>$v</code> without looping through the object in some <code>foreach</code>?</p>