title: PHP foreach loop through multidimensional array
body: <p>I have an array:</p>
  
  <pre><code>$arr_nav = array( array( "id" =&gt; "apple", 
            "url" =&gt; "apple.html",
            "name" =&gt; "My Apple" 
          ),
          array( "id" =&gt; "orange", 
            "url" =&gt; "orange/oranges.html",
            "name" =&gt; "View All Oranges",
          ),
          array( "id" =&gt; "pear", 
            "url" =&gt; "pear.html",
            "name" =&gt; "A Pear"
          )       
   );
  </code></pre>
  
  <p>Which I would like to use a foreach loop to replace (which only allows me to set the number:</p>
  
  <pre><code>for ($row = 0; $row &lt; 5; $row++)
  </code></pre>
  
  <p>with the ability to display a <code>.first</code> and <code>.last</code> class for the relevant array values</p>
  
  <p><strong>Edit</strong></p>
  
  <p>I would like the data to be echoed as:</p>
  
  <pre><code>&lt;li id="' . $arr_nav[$row]["id"] . '"&gt;&lt;a href="' . $v_url_root . $arr_nav[$row]["url"] . '" title="' . $arr_nav[$row]["name"] . '"&gt;"' . $arr_nav[$row]["name"] . '&lt;/a&gt;&lt;/li&gt;' . "\r\n";
  </code></pre>
  
  <p>Many thanks for your quick responses. StackOverflow rocks!</p>