Bug #74412 [Opn->Nab]: Comparison of string with 0 (integer zero) is returning boolean true
| From: | peehaa@php.net | Date: | Tue, 11 Apr 2017 10:53:50 +0000 |
| Subject: | Bug #74412 [Opn->Nab]: Comparison of string with 0 (integer zero) is returning boolean true | ||
| References: | 1 | Groups: | php.standards |
| Request: | Send a blank email to standards-+get-1263@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74412&edit=1
ID: 74412
Updated by: peehaa@php.net
Reported by: anil dot shinde1 at gmail dot com
Summary: Comparison of string with 0 (integer zero) is
returning boolean true
-Status: Open
+Status: Not a bug
Type: Bug
Package: PHP Language Specification
Operating System: ubuntu0.16.04.4
PHP Version: 7.0.17
Block user comment: N
Private report: N
New Comment:
This is because type juggling that occurs.
Do strict comparisons instead (===)
Previous Comments:
------------------------------------------------------------------------
[2017-04-11 10:49:43] anil dot shinde1 at gmail dot com
Description:
------------
Comparison of string with 0 (integer zero) is returning boolean true
php -r "var_dump('A' == 0);"
bool(true)
Test script:
---------------
php -r "var_dump(('A' == 0));"
bool(true)
Expected result:
----------------
Comparison of string with 0 (integer zero) should return boolean false
Actual result:
--------------
bool(true)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74412&edit=1