Re: Formating Numbers
| From: | Nathan Rixham | Date: | Sun, 26 Apr 2009 15:17:16 +0000 |
| Subject: | Re: Formating Numbers | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-291992@lists.php.net to get a copy of this message | ||
Gary wrote:
I cant seem to get this to work for me. I want the number to be formated to money (us, 2 decimal points)./** * returns 4.3 as $4.30 (formats us dollars) * * @param $amount * @return string */ function us_dollar_format( $amount ) { return ( '$' . number_format($amount, 2, '.', '') ); } echo us_dollar_format(4.3);