Bug #18535 Updated: int to string comparison problem

From: Date: Wed, 24 Jul 2002 11:21:31 +0000
Subject: Bug #18535 Updated: int to string comparison problem
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-15035@lists.php.net to get a copy of this message
ID: 18535 Updated by: hholzgra@php.net Reported By: marcin.smieszek@pointblue.com.pl -Status: Open +Status: Bogus Bug Type: *General Issues Operating System: linux PHP Version: 4.2.1 New Comment: expected behaviour, use === to compare if you do not want type conversions to happen Previous Comments: ------------------------------------------------------------------------ [2002-07-24 06:31:17] marcin.smieszek@pointblue.com.pl any variable, set, but set to 0 (but not "0") compared with any string always returns true. try ------- if (0=="sth) {echo "problem";} ------- or sth like this: ------- $a=array("blahblah","1",1,"0",0); foreach ($a as $value) { if ($value == "aaaa") { echo "<b>true</b><br>"; } else { echo "false<br>"; } } ------ ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=18535&edit=1

« previous php.bugs (#15035) next »