Re: Strange 'if' test bug?

From: Date: Tue, 31 Aug 2004 15:35:29 +0000
Subject: Re: Strange 'if' test bug?
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-24478@lists.php.net to get a copy of this message
$key=0; $key=="muppet"?TRUE:FALSE; The reason this last comparison returns true is that since you are comparing an integer with a string, the strings gets converted to an integer and since "muppet" does not have any numeric character it gets converted to 0. In other words as far PHP in concerned you are comparing 0 with 0 which is why the result of comparison is a true statement. Any thoughts on this? Thanks Christian

« previous php.windows (#24478) next »