note 42082 deleted from function.money-format by tomsommer
| From: | tomsommer@php.net | Date: | Mon, 03 May 2004 05:22:00 +0000 |
| Subject: | note 42082 deleted from function.money-format by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-69124@lists.php.net to get a copy of this message | ||
Note Submitter: matt_at_casslin_dot_com
----
I'm running a windows server and this feature won't work... but here's a function I
made for displaying values with 2 number after the decimal point (i.e. 1245.12, 3.01 or 2.00)...
function format_money($VALUE){
if (strrchr($VALUE,".")==FALSE){ $VALUE="".$VALUE.".00"; }
$DECIMAL_POINT_POSITION = strrpos($VALUE,".")+1;
$AFTER_DECIMAL_POINT = substr($VALUE,$DECIMAL_POINT_POSITION,2);
if(strlen($AFTER_DECIMAL_POINT)=="1"){ $VALUE = "".$VALUE."0"; }
if(strlen($AFTER_DECIMAL_POINT)=="0"){ $VALUE = "".$VALUE."00"; }
return $VALUE;