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
 [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-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 22:01:31 2024 UTC