Bug #10508 Updated: Wrong result when comparing two specific strings via "==".
| From: | hholzgra@php.net | Date: | Thu, 26 Apr 2001 09:56:38 +0000 |
| Subject: | Bug #10508 Updated: Wrong result when comparing two specific strings via "==". | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-52482@lists.php.net to get a copy of this message | ||
ID: 10508
Updated by: hholzgra
Reported By: swift@fanpro.com
Status: Closed
Bug Type: Scripting Engine problem
PHP Version: 4.0.4pl1
Assigned To:
Comments:
use === to compare strings without auto-conversion
Previous Comments:
---------------------------------------------------------------------------
[2001-04-26 05:49:31] cynic@php.net
this (mis- but shh, don't tell anyone :)feature has already caused much confusion. the reason:
"0000d0" is automagically converted to 0, just like the other string.
you're welcome.
---------------------------------------------------------------------------
[2001-04-26 05:41:21] swift@fanpro.com
Hi!
This seems to be a bug:
<?php $TextColor="000000"; if ($TextColor == "0000D0") echo "Why?";
?>
This will produce the output "Why?" on my system ... but: why?
"000000" isn't equal "0000D0"!?
If I'm wrong, please tell me why ... thanks!!
... tobias wiersch
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=10508&edit=2