Re: Formating Numbers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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);

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux