PHP 4.0 Bug #7591 Updated: continue doesn't work inside switch statement
| From: | stas@php.net | Date: | Sun, 05 Nov 2000 16:40:52 +0000 |
| Subject: | PHP 4.0 Bug #7591 Updated: continue doesn't work inside switch statement | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-37189@lists.php.net to get a copy of this message | ||
ID: 7591
Updated by: stas
Reported By: joel@azursoft.fr
Status: Closed
Bug Type: Scripting Engine problem
Assigned To:
Comments:
continue relates to switch as a looping structure (just as break does), so what it does is to
continue switch. Use "continue 2;" to do what you want.
Previous Comments:
---------------------------------------------------------------------------
[2000-11-02 09:57:15] joel@azursoft.fr
When placed inside a switch statement located inside a for
loop, the continue doesn't work as usual in C:
the following code display the following output:
<?
for ( $i=0; $i<10; $i++ ) {
switch ( $i ) {
case 5: continue;
default:
echo "$i<br>";
}
echo "Should be printed only if i != 5 and now i == $i<br>";
}
?>
//output:
0
Should be printed only if i != 5 and now i == 0
1
Should be printed only if i != 5 and now i == 1
2
Should be printed only if i != 5 and now i == 2
3
Should be printed only if i != 5 and now i == 3
4
Should be printed only if i != 5 and now i == 4
Should be printed only if i != 5 and now i == 5
6
Should be printed only if i != 5 and now i == 6
7
Should be printed only if i != 5 and now i == 7
8
Should be printed only if i != 5 and now i == 8
9
Should be printed only if i != 5 and now i == 9
// End of output
The line :
Should be printed only if i != 5 and now i == 5
should not appear
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=7591