Echo Number_format (88899626759579787, 0, ', ');
Why does the output result be 88899626759579792?
Reply to discussion (solution)
I am also a novice, asked the next degree Niang, she said, the format is wrong!
Originated from http://www.w3school.com.cn/php/func_string_number_format.asp
Because your environment should be 32-bit, to show you the above 88899626759579787 number, to use floating-point type, and the precision of floating-point type is no way to guarantee.
You can tell by this example.
Echo Php_int_max; PHP's shaping can represent the largest integer var_dump (Number_format (88899626759579700, 0, ', '));
When posting, hesitate to write the environment.
The development environment is Win7 64bit and the production environment is CentOS 64bit.
Still the same mistake.
Is there a way out?
This is the number from the other API to marry, the direct display of the words will show the technology counting method.
Use of the Strval function is also not good use.
Thank you!
Because your environment should be 32-bit, to show you the above 88899626759579787 number, to use floating-point type, and the precision of floating-point type is no way to guarantee.
You can tell by this example.
Echo Php_int_max; PHP's shaping can represent the largest integer var_dump (Number_format (88899626759579700, 0, ', '));
Other than that. The API returns JSON data. I use Json_decode () as if it were automatically converted into a numeric type.
There is also PHP 64-bit version of the.
Have you ever tried to change it by #1 say?
Have you ever tried to change it by #1 say?
The 16-digit number is so.
Out of bounds, the long type of PHP cannot represent that large positive number
PHP Development organization has never released a 64-bit version of for win
If there is a condition, it would be better to upgrade to php5.4+, because PHP adds a parameter to Json_decode at 5.4.
5.4.0 The options parameter was added.
Bitmask of JSON decode options. Currently only json_bigint_as_string are supported (default is to cast large integers as floats)
The above routines will output: float (1.2345678901235E+19) string (20) "12345678901234567890"
If you cannot upgrade, we recommend that you first add a special identifier to the full numeric text that exceeds the int shape length first, for example
{"A": "12345678901234567890"}
Can be replaced by regular
{"A": "__12345678901234567890"}
When the Json_decode is finished, then the __ logo is removed
If there is a condition, it would be better to upgrade to php5.4+, because PHP adds a parameter to Json_decode at 5.4.
5.4.0 The options parameter was added.
Bitmask of JSON decode options. Currently only json_bigint_as_string are supported (default is to cast large integers as floats)
The above routines will output: float (1.2345678901235E+19) string (20) "12345678901234567890"
If you cannot upgrade, we recommend that you first add a special identifier to the full numeric text that exceeds the int shape length first, for example
{"A": "12345678901234567890"}
Can be replaced by regular
{"A": "__12345678901234567890"}
When the Json_decode is finished, then the __ logo is removed
Thank you for your detailed reply.
has been solved. And if the method cannot be upgraded is similar.
Only the data that is taken in the development environment is out of bounds, and there is no cross-border problem in the actual production environment.
So the string parsing method is resolved.
Thanks again!
Knot Stickers!