math - getting an odd division error with PHP number_format() -


My script calculates number x by dividing other numbers, ABC

X = A / B

When I use A number (2, A) on number A before calculating X, I get a very strange number. Actual figures:

1,045.00 / 5 = 0.2

But if I do not use number-format before A on the part of the partition, then I get the correct answer. Is the number-format in any way making non-numbers?

1045/5 = 209

number edit The number can be used only when printing beautiful numbers

Example:

If $ A = 1045; then will be number_format ($ A, 2) 1,045.00 Now if you treat 1,045.00 as a code, So it will be 1 in the form of a comma and the remaining four will not be ignored and 1/2 is 0.5 which you are receiving.


Comments