Saturday, 28 September 2013

PHP - number_format fails with math operations

PHP - number_format fails with math operations

The PHP function number_format produces weird results when using it with
math operations.
Run this...
echo number_format(32545000 - 24343400) . '<br>';
echo number_format(32545000) - number_format(24343400);
Why does the second one produce an answer of "8" instead of the correct
answer?

No comments:

Post a Comment