php - continue 2 and break in switch statement -
I am new to PHP and have seen the code below online in continue 2 and Break is a switch / case statement, what does it mean?
foreach ($ element as & element) {switch ($ element ['type']) {case a: if (condition1) issued 2; break; Case B: If (condition2) continues 2; break; } // The remaining code here, inside the loop, but outside the statement statement}
From:
Continue accepts an optional numerical argument which states how many levels should be closed, it should go to the end edge. The default value is 1, thus skipping to the end of the current loop.
to
If you have a switch inside a loop and want to continue, for the next iteration of the external loop, continue using 2 Please.
The PHP switch continues to execute the statement by the end of the block, or the first time it has a break statement. If you do not write statements of a break at the end of the statement list of any case, then PHP will execute the following case statements.
Explanation:Continues 2at 2 levels jumps to the next trip of the loop, which isforeachThebreak(break 1equals) eliminates the current loop, which is theswitch.If the code is found in "a" and
condition1or if type "b" andcondition2 >, then every, go to next$ Go to the Englishfor element$ elementand ignore the remaining switch options Otherwise, continue to the next switch option or, if this is the last switch option , Then execute any code after the switch.
Sorry, viper-7.com seems to be down for the time.
Comments
Post a Comment