Hi,
I encounter a funny limitation here with switch case as below:
The value for $sum is worked as expected for 1 to 8, but not for 0.
When the $sum=0, the first case will be return, which is "sum=8".
Is there any limitation / rules for switch case? Thanks for advice!
Keith
$sum=0;
switch($sum)
{
case ($sum==8):
echo "sum=8";
break;
case ($sum==7 || $sum==6):
echo "sum=7 or 6";
break;
case ($sum==2 || $sum==1):
echo "sum=2 or 1";
break;
case 0:
echo "sum=0";
break;
default:
echo "sum=3/4/5";
break;
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php