php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63220 Camparison Operator
Submitted: 2012-10-05 03:16 UTC Modified: 2012-10-05 03:48 UTC
From: ellyx at dewata-production dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.3.7 OS: Opensuse 12.1
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: ellyx at dewata-production dot com
New email:
PHP Version: OS:

 

 [2012-10-05 03:16 UTC] ellyx at dewata-production dot com
Description:
------------
I think there is a bug in comparison operator, 
when i compare 0 with string 'ids' it return true, it should be return false

Test script:
---------------
var_dump(0 == 'ids')
if(0 == 'ids'){
echo 'true';
}
$str = 'ids';
if(0 == $str){
echo 'test';
}

Expected result:
----------------
false

Actual result:
--------------
true
'true'
'test'

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-10-05 03:23 UTC] ellyx at dewata-production dot com
I think it not just the comparison with string 'ids', i think this happen in 
every string end with 'ids' for example

var_dump(0 == 'testIds');

Expected: false
Actual: true
 [2012-10-05 03:23 UTC] ellyx at dewata-production dot com
-PHP Version: 5.3.17 +PHP Version: 5.3.7
 [2012-10-05 03:48 UTC] pierrick@php.net
-Status: Open +Status: Not a bug
 [2012-10-05 03:48 UTC] pierrick@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

http://www.php.net/manual/fr/types.comparisons.php
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 08 17:01:35 2025 UTC