From:             sadmac at earthlink dot net
Operating system: Windows XP
PHP version:      4.3.11
PHP Bug Type:     Feature/Change Request
Bug description:  continue behavior in switch has a potential use

Description:
------------
When the user uses continue in a switch, it behaves essentially the way a
break behaves. However, the name might imply (and I already have use for
this feature) that the switch statement would then continue evaluating
cases, and execute any code under another case statement further down in
the switch which fit the condition.

Reproduce code:
---------------
<?php

$j = 0;

switch($j)
{
   case 0:
       echo "part one ";
       break;
   case 1:
       //blah blah blah
       break;
   case 0:
       echo "part two";
       break;
} //Will only ouput "part one"

switch($j)
{
   case 0:
       echo "part one ";
       continue;
   case 1:
       //blah blah blah
       continue;
   case 0:
       echo "part two";
       continue;
} //Should potentially output "part one part two"

?>

Expected result:
----------------
The first statement should behave as it currently would, the second should
evaluate both case 0s, not just the first.

Actual result:
--------------
Both switches evaluate only the first case 0.

-- 
Edit bug report at http://bugs.php.net/?id=33034&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=33034&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=33034&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=33034&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=33034&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=33034&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=33034&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=33034&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=33034&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=33034&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=33034&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=33034&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=33034&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=33034&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=33034&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=33034&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=33034&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=33034&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=33034&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=33034&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=33034&r=mysqlcfg

Reply via email to