From:             [EMAIL PROTECTED]
Operating system: Windows 2000
PHP version:      4.2.3
PHP Bug Type:     Scripting Engine problem
Bug description:  switch ... case ... statement cannot distinguish a string with 
integer 0

<?php

$a = 'center';
switch ($a) {
    case 'left':
    case 0: echo 'left';break;
    case 'right':
    case 2: echo 'right';break;
    default:echo 'center';
}

?>

The script should generate 'center',yet generate 'left';what's more,any
string assigned to variable $a will generate the same error. The reason is
the PHP scripting engine cannot distinguish a string with integer 0. I
wonder if the switch statement can only be applied on integers.

-- 
Edit bug report at http://bugs.php.net/?id=20780&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=20780&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=20780&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=20780&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=20780&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=20780&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=20780&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=20780&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=20780&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=20780&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=20780&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20780&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=20780&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=20780&r=isapi

Reply via email to