title: How to access three elements at a time in a loop?
body: <p>I am having an issue with slicing from an array within a loop. What I am trying to do is iterate through an array and for each day return 3 different sections from the array. So for example day one should return 0,1,2 day 2 should return 3,4,5 etc... I am using <code>array_slice()</code> and it works for the first iteration, but on subsequent iterations, it only returns an array with 1 item in it. Any help would be much appreciated!! </p>
  
  <p>Here is what I currently have:</p>
  
  <pre><code>foreach ($days as $day) {
      $j = $j + 1;
      var_dump("j" . $j);
      $activities = array_slice($activities, $j, $number_of_activities);
      var_dump("day" . $day);
      var_dump($activities);
  } 
  </code></pre>
  
  <p>This is what is returned from var_dump...</p>
  
  <pre><code>string(2) "j1"
  string(4) "day1"
  array(3) {
    [0]=&gt; int(1)
    [1]=&gt; int(2)
    [2]=&gt; int(3)
  }
  string(2) "j2"
  string(4) "day2"
  array(1) {
    [0]=&gt; int(3)
  }
  </code></pre>