Double Decimal
Moderator: General Moderators
Double Decimal
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.
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
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"
?>