I am working with the Twitter API at the moment and I have run into a problem. Every tweet ID is returned as 2147483647 (maximum value of 32-bit integer). I have worked out that the json data is retrieved correctly, but it is being messed up when it is being decoded.
Here is a very narrowed-down example:
So this code should echo out $data and then convert it into an array and echo that out.PHP Code:$data = "{\"id\":2755218950}";
echo "<pre>";
print_r($data);
echo "\n";
print_r(json_decode($data, 1));
echo "</pre>";
This is the output I get from executing this code:
How is this even possible? Does anybody have an idea what could cause the value of this number to be changed when the string is decoded?Code:{"id":2755218950} Array ( [id] => 2147483647 )








Bookmarks