#36938 [Opn->Bgs]: Type casting on boolean expressions doesn't work
| From: | bjori@php.net | Date: | Fri, 31 Mar 2006 21:25:52 +0000 |
| Subject: | #36938 [Opn->Bgs]: Type casting on boolean expressions doesn't work | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-95176@lists.php.net to get a copy of this message | ||
ID: 36938
Updated by: bjori@php.net
Reported By: daniele_dll at yahoo dot it
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Windows XP SP2 - Fedora Core 4
PHP Version: 5.1.2
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[2006-03-31 23:17:23] daniele_dll at yahoo dot it
Description:
------------
Type casting a value on an if doesn't work!
If i compare a string value with the same value type casted to an int
and this string doesn't contains a numeric value i recive a true from
the boolean expression!
I've tried many combinations but all return the same result
Thanks for the help
Reproduce code:
---------------
<?php
$valore = 'qwerty';
if ($valore == (int)$valore)
{
echo "variable contains a valid numeric value!";
}
else
{
echo "variable doesn't contains a valid numeric value!";
}
?>
Expected result:
----------------
$valore == (int)$valore --> FALSE
variable doesn't contains a valid numeric value!
Actual result:
--------------
$valore == (int)$valore --> TRUE
variable contains a valid numeric value!
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36938&edit=1