note 39346 added to function.money-format

From: Date: Sun, 25 Jan 2004 17:14:14 +0000
Subject: note 39346 added to function.money-format
Groups: php.notes 
Request: Send a blank email to php-notes+get-64161@lists.php.net to get a copy of this message
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 ---- Manual Page -- http://www.php.net/manual/en/function.money-format.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+39346 Delete -- http://master.php.net/manage/user-notes.php?action=delete+39346&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+39346&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#64161) next »