title: PHP: Loop Through Multidimensional Array
body: <p>I need to be able to loop over only a section at a time to populate content for some Tabs. What would be the best way to loop over just the <code>Videos</code> array?</p>
  
  <p>This is what I've tried:</p>
  
  <pre><code>foreach ($result['videos'] as $r) {
      $content = '&lt;tr&gt;';
      $content .= '&lt;td&gt;' . $r['id'] . '&lt;/td&gt;';
      $content .= '&lt;td&gt;' . $r['name'] . '&lt;/td&gt;';
      $content .= '&lt;td&gt;' . $r['body'] . '&lt;/td&gt;';
      $content .= '&lt;td&gt;' . $r['created'] . '&lt;/td&gt;';
      $content .= '&lt;td&gt;' . $r['modified'] . '&lt;/td&gt;';
      $content .= '&lt;/tr&gt;';
      echo $content;
  
  }
  
  
  
  Array
  (
      [images] =&gt; Array(...)
  
      [videos] =&gt; Array
          (
              [0] =&gt; Array
                  (
                      [id] =&gt; 7
                      [type] =&gt; 2
                      [name] =&gt; My Video
                      [body] =&gt; my_video.flv
                      [created] =&gt; 0000-00-00 00:00:00
                      [modified] =&gt; 2012-04-07 00:00:00
                  )
  
              [1] =&gt; Array
                  (
                      [id] =&gt; 13
                      [type] =&gt; 2
                      [name] =&gt; Yet another video
                      [body] =&gt; my_vid_man.flv
                      [created] =&gt; 0000-00-00 00:00:00
                      [modified] =&gt; 0000-00-00 00:00:00
                  )
  
              [2] =&gt; Array
                  (
                      [id] =&gt; 25
                      [type] =&gt; 2
                      [name] =&gt; asasd
                      [body] =&gt; asdasd
                      [created] =&gt; 0000-00-00 00:00:00
                      [modified] =&gt; 0000-00-00 00:00:00
                  )
  
          )
  </code></pre>