Re: money print out with two digits after , e.g. 49,00
| From: | Neill Robins | Date: | Tue, 08 May 2001 15:06:35 +0000 |
| Subject: | Re: money print out with two digits after , e.g. 49,00 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-51907@lists.php.net to get a copy of this message | ||
Tuesday, May 08, 2001, 10:34:51 AM, Ramiro Radjiman wrote:
RR> I want to changes 49.4 ---> 49,4
RR> 49,4 ----> 49,40
RR> the first rule is done with the code
RR> $totaal=49.4;
RR> $totaal=str_replace(".",",",$totaal);
RR> how can i do the second row??
RR> please help.
RR> greets Ramiro
Check out number_format() which should allow you to do what you need.
http://www.php.net/manual/en/function.number-format.php
If not, you could always format:
49.4 -> 49.40 -> str_replace() -> 49,40
--
Good Luck,
-Neill
freebsd@nc.rr.com