PHP out of the loop of "continue"

did not break out of the loop continue strong, continue only terminate this cycle and into the next cycle

The difference of break and continue as if we, like chess, not some people Qipin, threatens to lose, lift the board does not play, this is the break. There are people who know the phrase to lose, do not back down, losing a game again, this is continue. Marble platform price list

continue the control flowchart is as follows:

 

continue out of the loop of example, the following code

1

2

3

4

5

6

7

8

9

10

11

12

13

14

<?php  

   

for($i=0;$i<2;$i++) 

    for($j=1;$j<4;$j++) 

    

        if($j==2) 

        

            continue 2;   //跳出最近的一个for循环的2次循环(j=2和j=3) 

        

    echo '$i='.$i.'$j='.$j."<br>"

    

 ?>

Guess you like

Origin www.cnblogs.com/furuihua/p/12112482.html