How to get object property from each object in an array?
<p>Assuming I have an array of objects in PHP, something like:</p>

<pre><code>Array (
    [0] =&gt; stdClass Object (
            [id] =&gt; 1
            [name] =&gt; Title One
        )    
    [1] =&gt; stdClass Object (
            [id] =&gt; 2
            [name] =&gt; Title Two
        )

    [2] =&gt; stdClass Object (
            [id] =&gt; 7
            [name] =&gt; Title Seven
        )
)
</code></pre>

<p>What is the best way (i.e. fastest) to get an array of the IDs? i.e. <code>array(1,2,7)</code> I can loop manually but I feel there must be a better method.</p>

<p>Just saw <a href="http://stackoverflow.com/questions/1118994/php-extracting-a-property-from-an-array-of-objects">this in the similar questions</a> but there's a little debate over whether the accepted answer is really the best way, plus it's from 2 years ago. I'm on PHP 5.3.</p>
