diff --git a/language/control-structures.xml b/language/control-structures.xml index 91bd297bbc..54839edd68 100644 --- a/language/control-structures.xml +++ b/language/control-structures.xml @@ -1,5 +1,5 @@ - + Control Structures @@ -679,6 +679,14 @@ while (++$i) { skip the rest of the current loop iteration and continue execution at the beginning of the next iteration. + + + Note that in PHP the + switch statement is + considered a looping structure for the purposes of + continue. + + continue accepts an optional numeric argument which tells it how many levels of enclosing loops it should skip @@ -724,6 +732,15 @@ while ($i++ < 5) { on which value it equals to. This is exactly what the switch statement is for. + + + Note that unlike some other languages, the + continue statement + applies to switch and acts similar to break. If you + have a switch inside a loop and wish to continue to the next iteration of + the outer loop, use continue 2. + + The following two examples are two different ways to write the same thing, one using a series of if