Json_decode is a long integer with a loss of precision. why is the tid precision lost in the following php conversion process of windowxp? the last four digits, 6788 digits, are changed to 7000. why? Str {& quot; receiver_address & quot;: & quot; Suining city, Sichuan province & quot;, & quot; receiver_city & quot;: & quot; Suining City & quot;, & quot; json_decode long integer, loss of precision, why Windows xp
In the following php conversion: tid precision will be lost, and the last four digits, 6788, will become 7000. why?
Str = '{"receiver_address": "Suining city, Sichuan province", "receiver_city": "Suining City", "receiver_district": "Shehong County", "receiver_mobile": "15228662928 ", "receiver_name": "cai", "receiver_state": "Sichuan province", "receiver_zip": "100218", "sid": "114757372016788", "tid": 114757372016788 }';
Print_r (json_decode ($ str); exit;
Test environment:
A: centOS5 + php5 * can be correctly converted,
B: window xp + php526 + Apache2.2, error, loss of precision.
Thank you for your attention.
------ Solution --------------------
114757372016788 if it is a numerical value, it is beyond the range expressed by the long integer of a 32-bit machine.
You should treat it as a string, just like sid
------ Solution --------------------
Encoding problems
------ Solution --------------------
Double quotation marks on both sides of the number into a string for a try
------ Solution --------------------
The php module installed on linux is different from that installed on Windows, or the php configuration is different. Therefore, the calculation method of json_decode is different.
If you don't know how to do it, the simplest method is to convert the string into an integer in the js script.