title: PHP foreach with conditional
body: <pre><code>&lt;? foreach ($cases as $case) :?&gt;
  &lt;? if (isset($case['case_status']) &amp;&amp; ($case['case_status'] == 'Incomplete')) :?&gt;
  &lt;div&gt;
      &lt;div class="alert alert-error"&gt;    
          &lt;?= $warning ?&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>I'm trying to have that foreach print out the div only once if the condition is met. 
  The problem is, for every case that meets the condition the div is printed.</p>
  
  <p>I have tried using in_array, but I don't think I understand the syntax. Is in_array correct? Is there a better way to do this? </p>