I prefer:
round($value,2);
-Original Message-
From: Marek Kilimajer [mailto:[EMAIL PROTECTED]
Sent: Monday, May 17, 2004 5:10 AM
To: Mario
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] keeping the last zero
Mario wrote:
> Hi all
>
> I have a list of products with prices
> e.
Mario wrote:
Hi all
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.
Thanks
Mario
You want to format the number? Use number_format()
PS: Don't hijack threads.
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
Hi all
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.
Thanks
Mario
-
Marios Adamantopoulos
Web D
4 matches
Mail list logo