PHP 4.0 Bug #5805: continue does not work properly within a switch
| From: | ccurtis at aet-usa dot com | Date: | Thu, 27 Jul 2000 04:19:15 +0000 |
| Subject: | PHP 4.0 Bug #5805: continue does not work properly within a switch | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-26422@lists.php.net to get a copy of this message | ||
From: ccurtis@aet-usa.com
Operating system: Linux (Debian/Unstable)
PHP version: 4.0.0
PHP Bug Type: Scripting Engine problem
Bug description: continue does not work properly within a switch
Here is a script:
$n = 3;
while( --$n )
{ echo "Evaluating $n:<br>";
switch( $n )
{ case 2:
continue;
case 1:
break;
}
echo "fell through<br>";
}
Here is the output:
Evaluating 2:
fell through
Evaluating 1:
fell through
Here is what was expected:
Evaluating 2:
Evaluating 1:
fell through
Changing "continue" to "continue 2" makes it function correctly. This should
not be correct, as a switch is not generally regarded as a looping structure, and PHP does not
appear to treat it as one - the continue is simply treated as a break.