RE: [PHP-WIN] displaying neat and tidy currency notation?
| From: | George Pitcher | Date: | Sat, 04 Dec 2004 08:59:06 +0000 |
| Subject: | RE: [PHP-WIN] displaying neat and tidy currency notation? | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-25117@lists.php.net to get a copy of this message | ||
Thanks to all who responded. I did managed to write a working function last
night, but I've now dropped that one in favour of the sprintf() function.
Cheers
George
> -----Original Message-----
> From: re_action [mailto:re_action@fromru.com]
> Sent: 3 December 2004 5:28 pm
> To: George Pitcher
> Cc: php-windows@lists.php.net
> Subject: Re: [PHP-WIN] displaying neat and tidy currency notation?
>
>
> Hello George,
>
> Try something like this:
> $var = '25.5';
> $var = sprintf("%.2f", $var);
> echo $var;
>
> GP> Hi,
>
> GP> I want to be able to display the results of some calculations
> as currency
> GP> such as £25.50, but round($var,2) produces £25.5.
>
> GP> I've tried writing my own function but that just fouled up
> the calculation.
>
> GP> Any tips or suggestions?
>
> GP> Cheers
>
> GP> George in Oxford
>
>
>
>
> --
> Best regards,
> re_action
> mailto:re_action@fromru.com
>
>