php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #73815 bug in compare with ==
Submitted: 2016-12-26 11:34 UTC Modified: 2016-12-26 16:37 UTC
From: rebmann at strom-aus-windkraft dot de Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 7.1.0 OS:
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: rebmann at strom-aus-windkraft dot de
New email:
PHP Version: OS:

 

 [2016-12-26 11:34 UTC] 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'; }
?>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-26 16:37 UTC] jhdxr@php.net
-Status: Open +Status: Not a bug
 [2016-12-26 16:37 UTC] jhdxr@php.net
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);
```
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 20:00:02 2026 UTC