PHP What is the syntax for stopping the loop early?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/2865373/how-would-i-stop-this-foreach-loop-after-3-iterations">How would I stop this foreach loop after 3 iterations?</a>  </p>
</blockquote>



<p>I have a for loop in PHP.  </p>

<p>When a condition is met, I would like it to stop runnning, right now it still continues all the way to 10000 $i values.  I want it to totally stop after it finds 6 and continue with the rest of my code.</p>

<p>I have:</p>

<pre><code>$bigarray=...
$countrec=0;
for ($i=1;$i&lt;10000;$i++){
    if($countrec&lt;6){
    if(array_search($i,$bigarray)!=-1){
    echo "Test! $i&lt;br&gt;";
    $countrec++;
    }
    }
}
</code></pre>

<p>How can I stop it early?</p>
