Looping Nested Loops
<p>I have an array that looks like this except with over 40 more    </p>

<pre><code>Array
(
    [0] =&gt; stdClass Object
        (
            [id] =&gt; 1
            [name] =&gt; name
            [cost] =&gt; 20
            [firstname] =&gt;
                (
                    [0] =&gt; first 1
                    [1] =&gt; first 2
                )
            [lastname] =&gt;
                (
                    [0] =&gt; last 1
                    [1] =&gt; last 2
                )
            [username] =&gt;
                (
                    [0] =&gt; username 1
                    [1] =&gt; username 2
                )
        )
    [0] =&gt; stdClass Object
        (
            [id] =&gt; 1
            [name] =&gt; name
            [cost] =&gt; 20
            [firstname] =&gt;
                (
                    [0] =&gt; first 1
                    [1] =&gt; first 2
                )
            [lastname] =&gt;
                (
                    [0] =&gt; last 1
                    [1] =&gt; last 2
                )
            [username] =&gt;
                (
                    [0] =&gt; username 1
                    [1] =&gt; username 2
                )
        )
(
</code></pre>

<p>I am doing something like this to get the non nested arrays:</p>

<pre><code>foreach($data as $row){
    echo $row-&gt;id
}
</code></pre>

<p>but what would I do to get the nested arrays? I wanna be able to display them as:</p>

<p>firstname lastname</p>

<p>username</p>
