title: Wrap a div around every four divs
body: <p>I need a little help with a php loop for OpenCart.</p>
  
  <p>I need to do is wrap a div around the output of the data every 4 loops.</p>
  
  <p>I have the following</p>
  
  <pre><code>&lt;?php foreach ($categories as $category) { ?&gt;
  &lt;div class="col-lg-3 col-md-3"&gt;.....&lt;/div&gt;
  &lt;?php } ?&gt;
  </code></pre>
  
  <p><strong>I get this</strong></p>
  
  <pre><code>&lt;div class="col-lg-3 col-md-3"&gt;.....&lt;/div&gt;
  &lt;div class="col-lg-3 col-md-3"&gt;.....&lt;/div&gt;
  &lt;div class="col-lg-3 col-md-3"&gt;.....&lt;/div&gt;
  &lt;div class="col-lg-3 col-md-3"&gt;.....&lt;/div&gt;
  &lt;div class="col-lg-3 col-md-3"&gt;.....&lt;/div&gt;
  &lt;div class="col-lg-3 col-md-3"&gt;.....&lt;/div&gt;
  &lt;div class="col-lg-3 col-md-3"&gt;.....&lt;/div&gt;
  &lt;div class="col-lg-3 col-md-3"&gt;.....&lt;/div&gt;
  &lt;div class="col-lg-3 col-md-3"&gt;.....&lt;/div&gt;
  &lt;div class="col-lg-3 col-md-3"&gt;.....&lt;/div&gt;
  </code></pre>
  
  <p><strong>But what I'm hoping to get is</strong></p>
  
  <pre><code>&lt;div class="row"&gt;
  &lt;div class="col-lg-3 col-md-3"&gt;.....&lt;/div&gt;
  &lt;div class="col-lg-3 col-md-3"&gt;.....&lt;/div&gt;
  &lt;div class="col-lg-3 col-md-3"&gt;.....&lt;/div&gt;
  &lt;div class="col-lg-3 col-md-3"&gt;.....&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="row"&gt;
  &lt;div class="col-lg-3 col-md-3"&gt;.....&lt;/div&gt;
  &lt;div class="col-lg-3 col-md-3"&gt;.....&lt;/div&gt;
  &lt;div class="col-lg-3 col-md-3"&gt;.....&lt;/div&gt;
  &lt;div class="col-lg-3 col-md-3"&gt;.....&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="row"&gt;
  &lt;div class="col-lg-3 col-md-3"&gt;.....&lt;/div&gt;
  &lt;div class="col-lg-3 col-md-3"&gt;.....&lt;/div&gt;    
  &lt;/div&gt;
  </code></pre>
  
  <p>Any help would be greatly appreciated :)</p>