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
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: 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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC