php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55106 About operator ===
Submitted: 2011-07-01 11:54 UTC Modified: 2011-07-01 14:11 UTC
From: qq541921209 at gmail dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.3.6 OS: Windows 7 & Windows Server 2008
Private report: No CVE-ID: None
 [2011-07-01 11:54 UTC] qq541921209 at gmail dot com
Description:
------------
In the PHP Manual it is said that:
"$a === $b      Identical       TRUE if $a is equal to $b, and they are of the 
same type. (introduced in PHP 4)"
But when I test like that:

<?php
$A=4;
$B = '4' - '0';
echo '$A === $B ';
echo $A === $B?"true":"false";
//Out put $A === $B true
?>

I think $A and $B do not have same type, but there are in same values.

Is that a bugs?

I need help with this.

Test script:
---------------
<?php
$A=4;
$B = '4' - '0';
echo '$A === $B ';
echo $A === $B?"true":"false";
//Out put $A === $B true
?>

Expected result:
----------------
$A === $B true


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-01 11:57 UTC] aharvey@php.net
-Status: Open +Status: Bogus
 [2011-07-01 11:57 UTC] aharvey@php.net
This isn't a bug. '4' - '0' results in $B being an integer with value 4, which is 
identical to $A, both in type and value.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 16:01:29 2024 UTC