title: PHP Foreach , Where
body: <p>Is there a way of adding a where class to a foreach equation in PHP. </p>
  
  <p>At the moment I am adding an if to the foreach like this.</p>
  
  <pre><code>&lt;?php foreach($themes as $theme){
      if($theme['section'] == 'headcontent'){
         //Something
      }
  }?&gt;
  
  
  &lt;?php foreach($themes as $theme){
      if($theme['section'] == 'main content'){
         //Something
      }
  }?&gt;
  </code></pre>
  
  <p>Presumably the PHP has to loop through all results for each of these. Is there are more efficient way of doing this. Something like </p>
  
  <p><code>foreach($themes as $theme where $theme['section'] == 'headcontent')</code></p>
  
  <p>Can this be done</p>