Posted by Andrew @ Rockface on 10/13/52 11:34
TonyG wrote:
> Hello - what's the best way to convert a string value to a currency format?
>
> Have tried 'money_format', but my PHP version does not support it.
>
> String : 12.5
>
> Output: $12.50
>
> Thanks!
http://uk.php.net/manual/en/function.sprintf.php
echo sprintf("\$%01.2f", 12.5);
--
Andrew @ Rockface
np: Sham 69 - Borstal Breakout [stopped]
www.rockface-records.co.uk
Navigation:
[Reply to this message]
|