Hi!

I have a list of products with prices
e.g.

$100
$100.50
(those are examples, they can be anything, not all prices have decimal)

when I add those I get $200.5.

Is there a way to get $200.50.

if it is okay for you to add $100+$100 and get $200.00 you could use printf("$%1.2f",$price1+$price2); or $str=sprintf("$%1.2f",$price1+$price2);

HTH,
Oliver Hankeln

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to