title: How can I loop through an array in Php and get 3 items at a time?
body: <p>I want to loop through an array in Php and get 3 items at a time, for example if an array contains these numbers: <code>[1,2,3,4,5,6,7,8,9,10,11]</code>
  then I want to be able to loop through it and get 3 at a time, but if the list does not break evenly into 3's then get whatever is left over.</p>
  
  <p>So, in this example I would want (1,2,3), (4,5,6), (7,8,9), (10, 11). What is the easiest way to do this? This is what I have so far which is getting just one item at a time from the array:</p>
  
  <pre><code>            for ($w = 0; $w &lt; count($decoded_photos); $w++) {
                  $photo_reference = $decoded_photos[$w]["photo_reference"];
                  echo "photo reference " . $photo_reference;    
              }
  </code></pre>