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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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: Fri Apr 12 22:01:29 2024 UTC