php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26071 Number 0 is equal to any string.
Submitted: 2003-11-01 15:10 UTC Modified: 2003-11-01 15:33 UTC
From: flood87 at hot dot ee Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.0.0b1 (beta1) OS: Windows XP
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: flood87 at hot dot ee
New email:
PHP Version: OS:

 

 [2003-11-01 15:10 UTC] flood87 at hot dot ee
Description:
------------
The bug takes place in versions of php from 4 to 5. Because of some reasons number 0 is equated with any string. The equal operator (==) is used. The problem is well illustrated with the "Reproduce code".

Reproduce code:
---------------
$i = 0;
$b = $i == "str";
var_dump($b);

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

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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-01 15:17 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Use ===
 [2003-11-01 15:33 UTC] flood87 at hot dot ee
Oh, sorry. I did look through the documentation, but didn't find the needed page. For those, who have the same problem, the needed page is http://www.php.net/manual/en/types.comparisons.php .

Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Oct 05 04:01:29 2024 UTC