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
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: qq541921209 at gmail dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 00:01:36 2025 UTC