php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62579 two strings compare
Submitted: 2012-07-16 12:21 UTC Modified: 2012-07-16 12:51 UTC
From: bugzilla33 at gmail dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: 5.4.5RC1 OS: win7
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: bugzilla33 at gmail dot com
New email:
PHP Version: OS:

 

 [2012-07-16 12:21 UTC] bugzilla33 at gmail dot com
Description:
------------
two strings compare

Test script:
---------------
var_dump('00'=='000')

Expected result:
----------------
bool(false)

Actual result:
--------------
bool(true)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-07-16 12:36 UTC] ab@php.net
=== should be used for exact matching.
 [2012-07-16 12:41 UTC] bugzilla33 at gmail dot com
Why should be used === for exact matching?

left is string and right is string - the same type
 [2012-07-16 12:49 UTC] ab@php.net
I think you'll find this page useful :) 
http://www.php.net/manual/en/language.operators.comparison.php
 [2012-07-16 12:51 UTC] ab@php.net
-Status: Open +Status: Not a bug
 [2012-07-16 12:51 UTC] ab@php.net
Also this for further reading http://php.net/manual/de/language.types.type-
juggling.php
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Aug 12 15:01:24 2020 UTC