In PHP how do you format a number as currency handling cases such as 10 cents equaling "$.1";
Posted
by stormist
on Stack Overflow
See other posts from Stack Overflow
or by stormist
Published on 2010-04-22T18:16:51Z
Indexed on
2010/04/22
18:23 UTC
Read the original article
Hit count: 113
I currently do:
$totalBill = number_format($totalBill, 2);
$totalBill = '$'.$totalBill;
This does not handle cases though where the total is say 10 cents. It returns "$0.1" which I do not want. Does anyone have a better way?
© Stack Overflow or respective owner