Doc #73815 [Opn->Nab]: bug in compare with ==
| From: | jhdxr@php.net | Date: | Mon, 26 Dec 2016 16:37:06 +0000 |
| Subject: | Doc #73815 [Opn->Nab]: bug in compare with == | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-14292@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73815&edit=1
ID: 73815
Updated by: jhdxr@php.net
Reported by: rebmann at strom-aus-windkraft dot de
Summary: bug in compare with ==
-Status: Open
+Status: Not a bug
Type: Documentation Problem
Package: *General Issues
PHP Version: 7.1.0
Block user comment: N
Private report: N
New Comment:
see http://php.net/manual/en/types.comparisons.php
you are using loose comparision, and one of the operands is number, so the string will be converted
to number, which is 0 in your case.
try
```
var_dump('abcd' == '0');
var_dump('abcd' === 0);
```
Previous Comments:
------------------------------------------------------------------------
[2016-12-26 11:34:47] rebmann at strom-aus-windkraft dot de
Description:
------------
<?
if('gftrcjihzg'==0) { echo 'true'; }
?>
it gives out: true
This is the worst bug i have ever seen in my live !!!!!!!!!!
Test script:
---------------
<?
if('gftrcjihzg'==0) { echo 'true'; }
?>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73815&edit=1