#26821 [Bgs]: if("NANC" < 0) - always evaluates TRUE
| From: | ivo at benetech dot org | Date: | Tue, 06 Jan 2004 23:08:14 +0000 |
| Subject: | #26821 [Bgs]: if("NANC" < 0) - always evaluates TRUE | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969357997@lists.php.net to get a copy of this message | ||
ID: 26821
User updated by: ivo at benetech dot org
Reported By: ivo at benetech dot org
Status: Bogus
-Bug Type: Scripting Engine problem
+Bug Type: Documentation problem
Operating System: Linux / RH 7.3
PHP Version: 4.3.4
New Comment:
Documentation needs to be more explicit about php being strongly
typed.
http://www.php.net/manual/en/language.types.type-juggling.php
or
http://www.php.net/manual/en/language.types.string.php#language.types.string.conversion
Previous Comments:
------------------------------------------------------------------------
[2004-01-06 17:23:58] sniper@php.net
RTFM:
http://www.php.net/manual/en/types.comparisons.php
(never ever compare different types like that)
------------------------------------------------------------------------
[2004-01-06 16:28:47] ivo at benetech dot org
Description:
------------
The statement...
if("NANC" < 0)
...always evaluates TRUE.
Reproduce code:
---------------
if("NANC" < 0)
{
print("should not happen...but does\n");
}
else
{
print("should happen...but doesnt\n");
}
Expected result:
----------------
echoed to the console:
should happen...but doesnt
Actual result:
--------------
echoed to the console:
should not happen...but does
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26821&edit=1