Usage of PHP function continue in the loop structure. The difference between the actual PHP function continue is that we accept an optional numeric parameter to decide to skip several repeated loops to the end of the loop. In php, continue is used in the loop structure in our actualThe difference between the PHP function continue is that it accepts an optional numeric parameter to decide to skip several repeated loops to the end of the loop.
In php, continue is used in the loop structure to skip the remaining code in this loop and start executing the next loop. This is the same as that in other languages. However, the other trick is that continue accepts an optional numeric parameter to decide to skip several iterations to the end of the loop.
- #php_continue.php
-
- $i = 0;
- $j = 0;
- while ($i++ <3) {//level 3
- echo "Outer
- n";
- while (1){//level 2
- echo "Middle
- n";
- while (1){//level 1
- echo "Inner
- n";
- continue 3;
- }
- echo "Thisnever gets output.
- n";
- }
- echo"Neither does this.
- n";
- $j++;
- //after runscontinue 3,it comes to the end of level 3
- }
- echo"$j=$j";//output: $j=0
- ?>
The above code is the specific usage of the PHP function continue. I hope it will be helpful to you.
The unique feature of the pipeline PHP function continue is that it accepts an optional numeric parameter to decide to skip several repeated loops to the end of the loop. In php, continue is used in the loop structure...