title: Target every two items in a PHP array
body: <p>I've been scratching my head at this for a little bit and cannot come up with a solution.</p>
  
  <p>I have a text block filled with <code>&lt;li&gt;</code> elements. I have used:</p>
  
  <pre><code>$array = explode("&lt;li&gt;", $text_block);
  </code></pre>
  
  <p>to separate these li's into different array elements. I need to create a foreach loop which will print all of these elements, but also apply a div to each two elements, for example:</p>
  
  <pre><code>&lt;div&gt;
  &lt;li&gt;First array item&lt;/li&gt;
  &lt;li&gt;Second array item&lt;/li&gt;
  &lt;/div&gt;
  
  &lt;div&gt;
  &lt;li&gt;Third array item&lt;/li&gt;
  &lt;li&gt;Fourth array item&lt;/li&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>And so forth unto the array is empty.</p>
  
  <p>Has anybody encountered a similar problem or have any solutions towards this?</p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>Jamie</p>