How to traverse a 3-level array for a specific keyword in PHP
<p>I have a 3 level array. I want to display the value of a particular keyword. This keyword appears in both the 2nd level and the 3rd level. But i want to display just the 2nd level.</p>

<p>Any idea how to do this? I have tried the following but it is displaying out all the values of the key "name".</p>

<pre><code>$jsonIterator = new RecursiveIteratorIterator(
        new RecursiveArrayIterator(json_decode($call_result, TRUE)),
        RecursiveIteratorIterator::SELF_FIRST);
        foreach ($jsonIterator as $key =&gt; $val) {

            if(strcmp ( $key , "name") == 0)
            {
                 //echo '&lt;br&gt;';
                 if(strcmp($val , " ")== 1)
                 {
                    echo "$key =&gt; $val\n";
                 }

            }
}
</code></pre>

<p>Any idea, how to just print out the value of the 2nd level only?</p>

<p>Thanks in Advance.</p>
