php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52541 10 == '10px' => true !
Submitted: 2010-08-05 10:12 UTC Modified: 2010-08-05 12:35 UTC
From: developer dot mahmoud at gmail dot com Assigned:
Status: Not a bug Package: Variables related
PHP Version: 5.3SVN-2010-08-05 (SVN) OS: win 7
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: developer dot mahmoud at gmail dot com
New email:
PHP Version: OS:

 

 [2010-08-05 10:12 UTC] developer dot mahmoud at gmail dot com
Description:
------------
when i compare between number and string it compare only the number in the string


Test script:
---------------
$id = 10;

if($id == '10px')
   echo 'yes'; // it say yes ! 

Expected result:
----------------
it say yes !
but 10 != '10px'


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-08-05 10:16 UTC] rasmus@php.net
-Status: Open +Status: Bogus
 [2010-08-05 10:16 UTC] rasmus@php.net
Use === if you want a strict comparison.  Otherwise since you are comparing an int 
to a string, it will compare the integer value of the string, which is 10 to 10 
and it will match.
 [2010-08-05 12:35 UTC] developer dot mahmoud at gmail dot com
i understand now
thanks
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 13:01:30 2024 UTC