title: PHP - Access multidimensional array
body: <p>I've read a lot of answers here on SO but I am still troubled when it comes to getting my head around how to access the correct part of my multidimensional array. </p>
  
  <p>What I am after is each <strong>client_img > sizes > w720h720c1 > path</strong>.</p>
  
  <p>My array looks like:</p>
  
  <pre><code>Array ( 
  [0] =&gt; Array ( 
      [_id] =&gt; 26 
      [client_text] =&gt; This is text from mathews testimonial 
      [client_img] =&gt; Array ( 
          [assetID] =&gt; 9 
          [title] =&gt; Client img 
          [_default] =&gt; /perch/resources/clientimg.jpg 
          [bucket] =&gt; default 
          [path] =&gt; clientimg.jpg 
          [size] =&gt; 421055 [w] =&gt; 736 [h] =&gt; 443 
          [mime] =&gt; image/jpeg 
          [sizes] =&gt; Array ( 
              [thumb] =&gt; Array ( 
                  [w] =&gt; 150 [h] =&gt; 90 
                  [target_w] =&gt; 150 
                  [target_h] =&gt; 150 
                  [density] =&gt; 2 
                  [path] =&gt; clientimg-thumb@2x.jpg 
                  [size] =&gt; 25217 
                  [mime] =&gt; image/jpeg 
                  [assetID] =&gt; 10 
              ) 
              [w720h720c1] =&gt; Array ( 
                  [w] =&gt; 720 
                  [h] =&gt; 433 
                  [target_w] =&gt; 720 
                  [target_h] =&gt; 720 
                  [crop] =&gt; true 
                  [density] =&gt; 1 
                  [path] =&gt; clientimg-w720h720.jpg 
                  [size] =&gt; 88584 
                  [mime] =&gt; 
                  [assetID] =&gt; 91 
                  ) 
              )
          ) 
          [client_name] =&gt; 
          Mathew D 
          [_page] =&gt; * 
          [_pageID] =&gt; 1 
          [_sortvalue] =&gt; Mathew D 
      ) 
      [1] =&gt; Array ( 
          [_id] =&gt; 24 
          [client_text] =&gt; This is text from paragraph one 
          [client_img] =&gt; Array ( 
              [assetID] =&gt; 3 
              [title] =&gt; Service 1 
              [_default] =&gt; /perch/resources/service1.jpg 
              [bucket] =&gt; default 
              [path] =&gt; service1.jpg 
              [size] =&gt; 449233 
              [w] =&gt; 800 
              [h] =&gt; 450 
              [mime] =&gt; image/jpeg 
              [sizes] =&gt; Array ( 
                  [thumb] =&gt; Array ( 
                      [w] =&gt; 150 
                      [h] =&gt; 84 
                      [target_w] =&gt; 150 
                      [target_h] =&gt; 150 
                      [density] =&gt; 2 
                      [path] =&gt; service1-thumb@2x.jpg 
                      [size] =&gt; 22588 
                      [mime] =&gt; image/jpeg 
                      [assetID] =&gt; 4 
                  ) 
                  [w720h720c1] =&gt; Array ( 
                      [w] =&gt; 720 
                      [h] =&gt; 405 
                      [target_w] =&gt; 720 
                      [target_h] =&gt; 720 
                      [crop] =&gt; true 
                      [density] =&gt; 1 
                      [path] =&gt; service1-w720h720.jpg 
                      [size] =&gt; 86733 
                      [mime] =&gt; 
                      [assetID] =&gt; 90 
                  ) 
              )
          ) 
          [client_name] =&gt; Rosie walker 
          [_page] =&gt; * 
          [_pageID] =&gt; 1 
          [_sortvalue] =&gt; Rosie walker 
      ) 
  ) 
  </code></pre>
  
  <p>I've tried this:</p>
  
  <pre><code>foreach($testimonials as $testimonial) {
      foreach($testimonial['client_img'] as $image) {
          echo $image['sizes']['w720h720c1'];
      }
  }
  </code></pre>
  
  <p>But I get an error of: <strong>Undefined index: sizes</strong></p>
  
  <p>Guidance on what I am doing wrong would be much appreciated.</p>