#49179 [Opn->Bgs]: zero problem in if and switch

From: Date: Thu, 06 Aug 2009 20:07:14 +0000
Subject: #49179 [Opn->Bgs]: zero problem in if and switch
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-140742@lists.php.net to get a copy of this message
ID: 49179 Updated by: jani@php.net Reported By: steve at ezd dot com -Status: Open +Status: Bogus Bug Type: *General Issues Operating System: linux PHP Version: 5.2.10 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 PLEASE search the bug database before you submit same issue as a bug again. This is not a bug. It's said in the manual too, try reading that also. Previous Comments: ------------------------------------------------------------------------ [2009-08-06 16:05:55] steve at ezd dot com Description: ------------ please run source code, it's self explained it seems that when use 0 to compare with string, it returns true all the time, problem in if is when using ==, === has no problem in switch case, it matches the first non number case Reproduce code: --------------- if (0=="a") echo "this is ture."; $check=0; switch ($check) { case 'a': echo "this is a "; break; default : echo "no match"; } Expected result: ---------------- no match Actual result: -------------- this is ture.this is a ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49179&edit=1

« previous php.bugs (#140742) next »