|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-03-06 08:03 UTC] stas@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Mon Jan 05 08:00:01 2026 UTC |
When a continue is used inside of a switch statement (inside a loop), it does not jump to the top of the next loop iteration, but instead jumps out of the switch statement and proceeds to execute the code following the switch. The following code snippet should give a good example: <?php for( $i = 0; $i < 10; $i++ ) { switch( $i ) { case 5: continue; default: $garbage = 0; // do something unimportant } echo "$i<BR>"; } ?> The output *should* be the numbers 0 to 4 & 6 to 9 listed down the screen, skipping 5. Instead, 5 appears in the list making it a complete 0 to 9.