I have a form that passes a value to a credit card processing gateway. The form takes the user's input does a couple of calculations to determine a processing fee and then sends the calculated amount along with card information to the gateway.
The calculations sometime result in a number with more than two digits to the right of the decimal point. Previously, this has not been a problem as the gateway trimmed to two digits. (sloppy, I know). The gateway seems to have changed and now rejects numbers with more than 2 digits to the right of the decimal.
My question is: Does number_format() return a string or a real number? If I use $totalVal = number_format($someVal, 2) and pass that to the gateway, will it receive a real number as it is expecting?
Is there a better way to put the calculated number into a correct currency format?
Thanks