How to exit a loop on condition?
<pre><code>$arr = array(1, 2, 3, 4);
foreach ($arr as $value) {
    $i=0;
    if($i==1||$i==2){continue;}
    echo $value;
    $i++;
}
</code></pre>

<p>I am a newbie of PHP, now i do a test, and i want to go out the loop not output 2 and 3, why the above code doesn't work?</p>
