The following examples illustrate
The break is used to jump out of the current execution loop and no longer executes the loop.
Copy Code code as follows:
<?php
$i = 0;
while ($i < 7) {
if ($arr [$i] = = "Stop") {
Break
}
$i + +;
}
?>
Continue immediately stops the current execution loop and returns to the loop's conditional judgment to continue the next loop.
Copy Code code as follows:
<?php
while (the list ($key, $value) = each ($arr)) {
if ($key = = "Zhoz") {//If the value of the query to the object is equal to Zhoz, the record is not displayed.
Continue
}
Do_something ($value);
}
Example 2
foreach ($list as $temp) {
if ($temp->value = = "Zhoz") {
Continue If the value of the query to the object equals Zhoz, the record is not displayed.
}
Do_list; This shows the records in the array
}
?>
Note: You cannot use goto loop instructions in PHP.