title: add div to the foreach loop?
body: <pre><code>&lt;?php foreach ($fields as $id =&gt; $field): ?&gt;
  &lt;div class="&lt;?php print $field-&gt;class; ?&gt;"&gt;
   &lt;?php print $field-&gt;content; ?&gt;
   &lt;/div&gt;
  &lt;?php endforeach; ?&gt;
  </code></pre>
  
  <p>the loop's result is as the following,</p>
  
  <pre><code>   &lt;div class="1"&gt;.....&lt;/div&gt;
     &lt;div class="2"&gt;.....&lt;/div&gt;
     &lt;div class="3"&gt;.....&lt;/div&gt;
     &lt;div class="4"&gt;.....&lt;/div&gt;
  
  
     &lt;div class="1"&gt;.....&lt;/div&gt;
     &lt;div class="2"&gt;.....&lt;/div&gt;
     &lt;div class="3"&gt;.....&lt;/div&gt;
     &lt;div class="4"&gt;.....&lt;/div&gt;
  
     &lt;div class="1"&gt;.....&lt;/div&gt;
     &lt;div class="2"&gt;.....&lt;/div&gt;
     &lt;div class="3"&gt;.....&lt;/div&gt;
     &lt;div class="4"&gt;.....&lt;/div&gt;
  </code></pre>
  
  <p>i want to group the first <code>&lt;div&gt;</code> like this.</p>
  
  <pre><code>    &lt;div class="group"&gt;
     &lt;div class="1"&gt;.....&lt;/div&gt;
     &lt;div class="2"&gt;.....&lt;/div&gt;
     &lt;div class="3"&gt;.....&lt;/div&gt;
     &lt;/div&gt;
    &lt;div class="4"&gt;.....&lt;/div&gt;
  </code></pre>
  
  <p>how to make the foreach</p>