Page 1 of 1

Double Decimal

Posted: Mon May 09, 2005 12:00 pm
by ndnow
A while ago a program was created to create an invoice in PHP. Now lately we have been getting complaints about some orders being sent with two decimals. Now I have changed the formatting of the variable for the total using a few different functions provided by php hoping it was a bug but it doesn't seem like it. I've used an ereg replace funciton to check for it before its sent just in case so I'm really thinking its client side but I need to make sure no one else has ever had this problem before.

Posted: Mon May 09, 2005 5:16 pm
by Skara
posting a bit of code would help...

Posted: Tue May 10, 2005 11:53 am
by ndnow
the code is fine just wondering if anyone knew of a bug in money_format or a mail client bug or some form of a bug.

Posted: Tue May 10, 2005 11:57 am
by phpScott
since we haven't seen the code to see what you are doing for the formating I can only suggest
from the manual http://www.php.net/sprintf

Code: Select all

<?php
$money1 = 68.75;
$money2 = 54.35;
$money = $money1 + $money2;
// echo $money will output "123.1";
$formatted = sprintf("%01.2f", $money);
// echo $formatted will output "123.10"
?>