|
Posted by Alvaro G. Vicario on 10/07/06 19:16
*** mantrid escribió/wrote (Sat, 07 Oct 2006 18:36:03 GMT):
> $price=number_format($price/100,2);
> $price=number_format($price,2)/100;
> 80 becomese 1 instead of 0.8
> 180 becomes 2 instead of 1.8
In my system, this code:
<?php
echo number_format(80/100, 2) . "\n";
echo number_format(80, 2)/100 . "\n";
?>
prints this output:
0.80
0.8
:-?
You can try forcing a cast to float, that works in other languages:
(float)$foo
100.0
--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--
Navigation:
[Reply to this message]
|