Re: problem with intval and !=
| From: | DvDmanDT | Date: | Thu, 23 Oct 2003 20:44:21 +0000 |
| Subject: | Re: problem with intval and != | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-167356@lists.php.net to get a copy of this message | ||
Outputs
Number: 12, Value: 12.3
Bad
for me running XP home nosp, Apache 1.3.28 mod_php 4.3.4rc2, or as
standalone cgi...
--
// DvDmanDT
MSN: dvdmandt@hotmail.com
Mail: dvdmandt@telia.com
"Cesar Cordovez" <phpguru@cesamo.com> skrev i meddelandet
news:3F97E38A.1080705@cesamo.com...
> 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