problem with intval and !=
| From: | Cesar Cordovez | Date: | Thu, 23 Oct 2003 14:19:54 +0000 |
| Subject: | problem with intval and != | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-167280@lists.php.net to get a copy of this message | ||
Can somebody explain me why is this happening?
$value = "12.3";
$number = intval($value);
echo "Number: $number, Value: $value<br>";
// echoes: Number: 12, Value: 12.3
if ($number != $value) {
echo "Bad";
} else {
echo "Good"; // echoes Good!!!!!!
}
The previous should be echoing "Bad". (I think!)
Cesar