note 50442 rejected from function.intval by nlopess
| From: | nlopess@php.net | Date: | Mon, 28 Feb 2005 18:14:21 +0000 |
| Subject: | note 50442 rejected from function.intval by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-85683@lists.php.net to get a copy of this message | ||
Note Submitter: luciano at vittoretti dot com dot br
----
Bug on intval?
<?php
$value = "150,45";
$value = str_replace(",", ".", $value) * 100;
echo $value. "<BR>"; // output 15045
$value = intval($value);
echo $value; // output 15044 ??? why?
?>
I think it happens cause my initial $value is a string . But when I multiply by 100 this value
converts in a decimal. So take care.
PHP 4.3.9