pkromer
asked on
PHP currency formatting, remove comma
I have code that is returning a comma in a number higher than 1000 and I need to get rid of the comma.
This current code returns a number with a comma if the number is higher than 1000...
$totals = array('subtotal' => number_format($subtotal,2) ,
'total' => number_format($order['Orde rTotal'],2 ));
This code does not return the comma but does add two extra zeroes after the decimal point, so it returns something like 1252.3400...
$totals = array('subtotal' => ($subtotal),
'total' => ($order['OrderTotal']));
So, that second code bit "fixes" the issue with the comma but now I need to get rid of the two extra zeros at the end returned by that second block of code.
This current code returns a number with a comma if the number is higher than 1000...
$totals = array('subtotal' => number_format($subtotal,2)
'total' => number_format($order['Orde
This code does not return the comma but does add two extra zeroes after the decimal point, so it returns something like 1252.3400...
$totals = array('subtotal' => ($subtotal),
'total' => ($order['OrderTotal']));
So, that second code bit "fixes" the issue with the comma but now I need to get rid of the two extra zeros at the end returned by that second block of code.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you thank you.
'total' => ($order['OrderTotal']));