note 39346 deleted from function.money-format by tularis
| From: | tularis@php.net | Date: | Sun, 06 May 2007 09:05:20 +0000 |
| Subject: | note 39346 deleted from function.money-format by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-126236@lists.php.net to get a copy of this message | ||
Note Submitter: The Mighty Will
----
I didn't see it mentioned here, yet it threw me for a loop. Once you use this function, you
can no longer use these formatted numbers to perform normal math operations like addition. This may
be true with other functions as well, but I personally have experience with this scenario.
Example:
$curOne = money_format('%#4n',123.05);
#returns $ 123.05
$curTwo = money_format('%#4n',41.95);
#returns $ 41.95
echo $curOne + $curTwo;
#this will return $ 0.00
Instead:
$curOne = 123.05;
#returns 123.05
$curTwo = 41.95;
#returns 41.95
echo money_format('%#4n',$curOne + $curTwo);
#this will return $ 165.00