how to foreach the array in php?
<p>when i print_r($a); the output like this:</p>

<pre><code>Array
(
    [0] =&gt; stdClass Object
        (
            [tid] =&gt; 3
            [vid] =&gt; 1
            [name] =&gt; cPanel
            [description] =&gt; 
            [format] =&gt; 
            [weight] =&gt; 0
            [depth] =&gt; 0
            [parents] =&gt; Array
                (
                    [0] =&gt; 0
                )

        )

    [1] =&gt; stdClass Object
        (
            [tid] =&gt; 4
            [vid] =&gt; 1
            [name] =&gt; whm
            [description] =&gt; 
            [format] =&gt; 
            [weight] =&gt; 0
            [depth] =&gt; 0
            [parents] =&gt; Array
                (
                    [0] =&gt; 0
                )

        )

    [2] =&gt; stdClass Object
        (
            [tid] =&gt; 5
            [vid] =&gt; 1
            [name] =&gt; test
            [description] =&gt; 
            [format] =&gt; 
            [weight] =&gt; 0
            [depth] =&gt; 0
            [parents] =&gt; Array
                (
                    [0] =&gt; 0
                )

        )

)
</code></pre>

<p>the array key maybe increment. now, i want to output all the <code>name'</code>s value of the array.
when i used the following code. it shows me an error.</p>

<pre><code>foreach($a as $a-&gt;name){
    echo a-&gt;name;
}
</code></pre>
