title: PHP - Adding a div tag after a certain amount of results in a foreach loop
body: <p>I have a bit of a weird issue.</p>
  
  <p>I want to add a div tag around remaining results after a certain amount is reached in my foreach loop.</p>
  
  <p>So, after the loop returns 6 results, it wraps the rest in </p>
  
  <p>The code i have to return results at the moment is:</p>
  
  <pre><code>foreach ($fpbanners as $banners):
      &lt;img src="image.jpg" alt="image description" width="773" height="432" /&gt;
  endforeach;
  </code></pre>
  
  <p>At the end i need to source code to look something like the following so all results after the 6th is wrapped in the div tag</p>
  
  <pre><code>&lt;img src="image.jpg" alt="image description" width="773" height="432" /&gt;
  &lt;img src="image.jpg" alt="image description" width="773" height="432" /&gt;
  &lt;img src="image.jpg" alt="image description" width="773" height="432" /&gt;
  &lt;img src="image.jpg" alt="image description" width="773" height="432" /&gt;
  &lt;img src="image.jpg" alt="image description" width="773" height="432" /&gt;
  &lt;img src="image.jpg" alt="image description" width="773" height="432" /&gt;
  &lt;div class="test"&gt;
      &lt;img src="image.jpg" alt="image description" width="773" height="432" /&gt;
      &lt;img src="image.jpg" alt="image description" width="773" height="432" /&gt;
      &lt;img src="image.jpg" alt="image description" width="773" height="432" /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>Cheers,</p>