How to return an array as object in PHP?
<pre><code>function myfunc ()
{
    $a['foo'] = 'bar';
    $a['baz'] = 'qux';

    return $a;
}
</code></pre>

<p>How do you do it so that when you call <code>$a = myfunc();</code> you can use <code>echo $a-&gt;foo;</code> and it will output <code>bar</code>?</p>

<p>Additional question: Having that simple function above, is it better to return an array or object?</p>
