title: Split Foreach Into Different Sections
body: <p>I have an array of profiles. I want to loop through them and print out the data for each person. I'm using bootstrap so I'd like to have 3 profiles per row and then start a new row for another 3 profiles, like the following:</p>
  
  <pre><code>&lt;div class="row"&gt;
      &lt;div class="col-md-3"&gt;
          Profile Data
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>If I loop through using foreach, I'll get a new row each profile, when I'd like 3 profiles and then a new row:</p>
  
  <pre><code>foreach($profiles as $p){
      echo '&lt;div class="row"&gt;
          &lt;div class="col-md-3"&gt;
              '.$p-&gt;name.'
          &lt;/div&gt;
      &lt;/div&gt;';
  }
  </code></pre>
  
  <p>Can anyone advise me?</p>