All About the Money
Posted: Mon Feb 09, 2009 4:42 pm
I'm super confused trying to format this guys!! I'm making a shopping cart that tacks on 3%. I need the "cctotal" variable to have 2 numbers trailing the decimal (ex - 1.00, 5.25, 9.50). I don't care about a comma for a thousand dollar marker.
Sometimes, when I add the 3%, the number gets ugly, like 5.192059, I need it to be able to round up/down accordingly. Also, if it's just an even dollar amount (5.00, 10.00) or there is nothing in the tenth's place (5.10, 10.50) that is will show the 2nd trailing zero.
$onlinead = $onlinead * 1.03;
$cctotal = number_format($onlinead);
Right now, that won't give me trailing zeros I want!
Sometimes, when I add the 3%, the number gets ugly, like 5.192059, I need it to be able to round up/down accordingly. Also, if it's just an even dollar amount (5.00, 10.00) or there is nothing in the tenth's place (5.10, 10.50) that is will show the 2nd trailing zero.
$onlinead = $onlinead * 1.03;
$cctotal = number_format($onlinead);
Right now, that won't give me trailing zeros I want!