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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
10 + 31 = ?
Subscribe to this entry?

 
 [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: Tue Apr 23 09:01:27 2024 UTC