This section describes the php loop. The php loop statements include for, while, do .. while, switch, etc., should be the most used in actual programming, it is recommended that you firmly grasp. Welcome to the php loop tutorial page. 1. break: indicates the process of stopping the current for, while, do... while, and switch. a number can be provided later to indicate the layer to which the switch flow is redirected. For example:
"; Break; // jump out of the switch statement case 9: echo" quto to 9. "; Break 2; // The number in the while loop cannot exceed the actual number of layers. if it is written as break 3, the system reports an error. Default: break;} echo 'over! $ I = '. $ I;?> Result: quit to 4. quto to 9. Over! $ I = 9 2. continue statement: jump out of the remaining code in this loop and judge whether this condition is true for the next loop
";}Echo" Over ";?> Result: $ I = 0 $ I = 1 $ I = 2 $ I = 3 $ I = 4 $ I = 6 $ I = 7 $ I = 8 $ I = 9 $ I = 10 $ I = 11 $ I = 12 Over You can also add numbers after continue:
';}} Echo "Over" ;?> Result: $ I = 0 $ j = 1 $ I = 1 $ j = 1 Over 3. goto statement: only jump syntax in the same file or scope: goto label; label: // .. statement
Output: bb Thanks for your attention to the php getting started tutorial. this series of basic php tutorials will help new php beginners to quickly master the php programming language. The programmer's home will continue to provide php tutorials for you and wish you a better learning experience! |