Bug #747: continue semantics incorrect within switch statement?
| From: | rziegler at idea-net dot com | Date: | Mon, 14 Sep 1998 23:20:15 +0000 |
| Subject: | Bug #747: continue semantics incorrect within switch statement? | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-1073@lists.php.net to get a copy of this message | ||
From: rziegler@idea-net.com
Operating system: Solaris 2.6
PHP version: 3.0.3
PHP Bug Type: Parser error
Bug description:
I'm not sure that this is a bug, or a feature, but either way it
should probably be documented:
The following code segment does not work as a "C" programmer would
assume:
for ($i=1; $i<=10; $i++)
{
switch($i)
{
case 1: case 3: case 5: case 7: case 9:
break;
case 2: case 4: case 6: case 8: case 10:
continue;
}
print("$i is Odd\n");
}
If you change the "continue" to be a "continue 2", the code
works correctly. Because a continue (again, in C) does not apply to switch statement (only whiles
and fors), this does not seem correct.
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net