Re: displaying neat and tidy currency notation?
| From: | William Cox | Date: | Fri, 03 Dec 2004 16:48:22 +0000 |
| Subject: | Re: displaying neat and tidy currency notation? | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-25115@lists.php.net to get a copy of this message | ||
George,
have a look at number_format()
(http://us2.php.net/manual/en/function.number-format.php). that in
combo with round() should do the trick.
On Fri, 3 Dec 2004 16:16:27 -0000, n.a.morgan@bton.ac.uk
<n.a.morgan@bton.ac.uk> wrote:
> You could try concatenating a string of "0"s (£25.5000) on the end and using
> substr on the whole to get your £25.50.
>
> $currency = $currency . "000";
> $currency = substr( $currency, 0, strpos($currency,'.') + 3 )
>
> Neil Morgan
>
>
>
> -----Original Message-----
> From: George Pitcher [mailto:george.pitcher@ingenta.com]
> Sent: 03 December 2004 15:49
> To: php-windows@lists.php.net
> Subject: [PHP-WIN] displaying neat and tidy currency notation?
>
> Hi,
>
> I want to be able to display the results of some calculations as currency
> such as £25.50, but round($var,2) produces £25.5.
>
> I've tried writing my own function but that just fouled up the calculation.
>
> Any tips or suggestions?
>
> Cheers
>
> George in Oxford
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
William Cox
email: mydimension@gmail.com
blog: http://my-dimension.com