The php loop jumps out. Copy the code as follows: the current php loop is 1, and the loop increments from the inside to the outside. the default break is 1, for example, jumping out of the 2nd-layer loop for ($ i0; $ i3; $ I ++) {foreach (array (1, 2, 3) as $ val ){
The code is as follows:
// The Current php loop is 1, and the loop increases sequentially from the inside to the outside. the default break is 1, for example, jumping out of the 2nd-layer loop
For ($ I = 0; $ I <3; $ I ++ ){
Foreach (array (1, 2, 3) as $ val ){
Foreach (array (1, 2, 3) as $ val ){
Echo "layer-1 loop
";
Break 2; // jump out of the 2nd-layer loop
}
Echo "layer-2 loop
";
}
Echo "Layer 3 loop
";
}
// Result:
// Layer-1 loop
// Layer-3 loop
// Layer-1 loop
// Layer-3 loop
// Layer-1 loop
// Layer-3 loop
The http://www.bkjia.com/PHPjc/327959.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/327959.htmlTechArticle code is as follows: // php the current loop is 1, the cycle increments from inside to outside, break defaults to 1, for example, jumping out of the 2nd layer loop for ($ I = 0; $ i3; $ I ++) {foreach (array (1, 2, 3) as $ val ){...