php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10508 Wrong result when comparing two specific strings via "==".
Submitted: 2001-04-26 05:41 UTC Modified: 2001-04-26 05:56 UTC
From: swift at fanpro dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.4pl1 OS: W2K
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: swift at fanpro dot com
New email:
PHP Version: OS:

 

 [2001-04-26 05:41 UTC] swift at fanpro dot 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-26 05:49 UTC] 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:56 UTC] hholzgra@php.net
use === to compare strings without auto-conversion
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed May 07 10:01:28 2025 UTC