RE: [PHP] converting string to monetary format
| From: | Jay Blanchard | Date: | Tue, 13 Apr 2004 15:58:07 +0000 |
| Subject: | RE: [PHP] converting string to monetary format | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-183246@lists.php.net to get a copy of this message | ||
[snip]
Simple problem... I want to manipulate with PHP function to get "desired
output" below.
$var="59.9"
Desired Output:
$var="59.90"
I thought number_format would do the trick but no way, unless I just
missed something.. ?
[/snip]
it is number_format http://www.php.net/number_format
$var="59.9";
$var = number_format($var, 2, '.', '');
echo $var;