sigepmest37
September 7th, 2006, 04:41 PM
I've been trying to come up with a solution to a little PHP round() problem I'm having.
I'm trying to add tax to a subtotal...pretty simple:
$tax= round(($subTotal*.0825),2);
Most of the time this works fine, however, on the rare occasion that the tax comes back as a whole dollar or whole 10 cents, it drops the extra 0's at the end.
Is there a way to check if that has happened and add the necessary 0's (1 or 2) to the end of the string if needed?
Thanks for the help guys!!!
I'm trying to add tax to a subtotal...pretty simple:
$tax= round(($subTotal*.0825),2);
Most of the time this works fine, however, on the rare occasion that the tax comes back as a whole dollar or whole 10 cents, it drops the extra 0's at the end.
Is there a way to check if that has happened and add the necessary 0's (1 or 2) to the end of the string if needed?
Thanks for the help guys!!!