continue keyword is use for continue the current loop. Php also accepts an optional argument to continue several levels of loop.
Ok. Check following code.
What you expect as the result?
I have found this joke from php manual.
Ok. Check following code.
for ($i = 0; $i < 5; ++$i) { if ($i == 2) continue print "$i\n"; }
What you expect as the result?
0 1 3 4But result is...
2Because
continue print "$i\n";is a single expression. For your expected result you should add a ; after the continue.
I have found this joke from php manual.
No comments:
Post a Comment