continue to stop the current execution immediately Loop, and return to the condition judgment point of the loop to continue the next loop. Copy the code. The code is as follows: continue to stop the current execution immediately Loop, and return to the condition judgment point of the loop to continue the next loop. Copy the code. The code is as follows:
Home >Backend Development >PHP Tutorial >continue statement Analysis of the difference between break and continue process control instructions in PHP
The following example illustrates that
break is used to break out of the currently executing loop and no longer continue to execute the loop.
Copy code The code is as follows:
$i = 0;
while ($i < 7) {
if ($arr[$i] == "stop") {
break;
}
$i++;
}
?>
Copy code The code is as follows:
while (list($key,$value) = each($arr)) {
if ($key == "zhoz"){ / / If the value of the queried object is equal to zhoz, this record will not be displayed.
continue;
}
do_something ($value);
}
// Example 2
foreach ($list as $temp) {
if ($temp->value == "zhoz") {
continue; // If the value of the queried object is equal to zhoz, this record will not be displayed.
}
do_list; // The records in the array are displayed here
}
?>
The above introduces the analysis of the differences between the two process control instructions of break and continue in PHP, including the continue statement. I hope it will be helpful to friends who are interested in PHP tutorials.