#29155 [Opn->Bgs]: switch odd behaviour with mixed int/string variables

From: Date: Wed, 14 Jul 2004 14:49:33 +0000
Subject: #29155 [Opn->Bgs]: switch odd behaviour with mixed int/string variables
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-62258@lists.php.net to get a copy of this message
ID: 29155 Updated by: derick@php.net Reported By: phpbug at bart dot w-wa dot pl -Status: Open +Status: Bogus Bug Type: Variables related Operating System: Linux PHP Version: 4.3.7 New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php . Previous Comments: ------------------------------------------------------------------------ [2004-07-14 16:46:21] phpbug at bart dot w-wa dot pl Description: ------------ Due to FU typecasting switch produces unexpected results when one of the cases is string, but variable passed to switch is int. Reproduce code: --------------- $x = 0; switch($x) { case 'something': echo 'something'; break; case 0: echo 'zero'; break; default: echo 'something else'; }; Expected result: ---------------- zero Actual result: -------------- something ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29155&edit=1

« previous php.bugs (#62258) next »