title: Looping through array objects to output
body: <p>I have sent $data['items'] to my view which has created an array full of objects which I can echo with a foreach loop.</p>
  
  <pre><code>foreach($items as $row)
    {
      echo $row-&gt;NAME . " - " . $row-&gt;COLOUR . "&lt;br&gt;";
    }
  </code></pre>
  
  <p>what I want to do is echo them to the browser in groups with the name of the colour as a header tag then start the loop for that colour.  I'm just not sure what type of loop to do or should I have a loop within a loop?</p>
  
  <p>BLUE</p>
  
  <p>-item 1</p>
  
  <p>-item 3</p>
  
  <p>RED</p>
  
  <p>-item 2</p>
  
  <p>-item 4</p>
  
  <p>-item 5</p>