Source Code:
(back to article)
<?php // Example 1 $myArray = array(1, 2, 3, 4, 5); foreach ($myArray as $number) { if ($number == 3) { break; } echo $number . "<br>"; } // Output: 1<br>2<br> // Example 2 $i = 0; while (true) { $i++; if ($i == 5) { break; } } echo $i; // Output: 5
Result:
Report an issue