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
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: 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

Pull Requests

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: Thu Sep 19 07:01:27 2024 UTC