Sometimes, you might want to let the unconditional loop begin and allow the statements in parentheses to decide when to exit the loop.
There are two special statements that can be used for recycling: interrupts and continuation.
When a break statement terminates or a for loop, the following loop of the current code, if any, continues to execute. Or
You can put a number after the discount keyword, explaining how the loop structure is multi-layered to get rid of. So, Bury
Hidden in a statement deep nested loops can break the outermost loop.
<?php
echo "<p><b>example of using the" Break statement:</b></p> ";
For ($i =0 $i <=10; $i + +) {
if ($i ==3) {break;}
echo "The number is". $i;
echo "<br/>";
}
echo "<p><b>one More example of using the" Break statement:</b><p> ";
$i = 0;
$j = 0;
while ($i < 10) {
while ($j < 10) {
if ($j = = 5) {break 2;}//Breaks out of two while loops tutorial
$j + +;
}
$i + +;
}
echo "The" "the". $i. " <br/> ";
echo "The second number is". $j. " <br/> ";
?>
The continue statement terminates the execution of the next iteration loop while the statement block executes one or a for loop
:
<?php
echo "<p><b>example of using the Continue statement:</b><p>";
For ($i =0 $i <=10; $i + +) {
if (i==3) {continue;}
echo "The number is". $i;
echo "<br/>";
}
?>