php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9478 Two different types compare problem!
Submitted: 2001-02-27 08:59 UTC Modified: 2001-02-27 09:04 UTC
From: cryp at inet dot lv Assigned:
Status: Not a bug Package: Math related
PHP Version: 4.0.4pl1 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: cryp at inet dot lv
New email:
PHP Version: OS:

 

 [2001-02-27 08:59 UTC] cryp at inet dot lv
### CODE ###
$Flag = 0;
if ( $Flag == 'N' ) echo "1";
else echo "2";
### END ###
Result: 1

If the $Flag is integer value and 'N' non integer, why this operation gives true as the result?
This is different types 0 and 'N', but if the programm can compare this values, it will be better to give "false"!

Can you explane this ?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-27 09:04 UTC] stas@php.net
Use === for exact comparison. == is 'numeric' comparison.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 10:01:28 2024 UTC