Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $json = '{"foo":283675428357628352}';
- $obj = json_decode($json, false, JSON_BIGINT_AS_STRING);
- $json2 = json_encode($obj, JSON_NUMERIC_CHECK);
- var_dump($json === $json2); // true
- $json = '{"foo":9223372036854775807}';
- $obj = json_decode($json);
- $json2 = json_encode($obj);
- var_dump(PHP_INT_MAX, $obj, $json2);
- int(9223372036854775807)
- object(stdClass)#1 (1) {
- ["foo"]=>
- int(9223372036854775807)
- }
- string(27) "{"foo":9223372036854775807}"
Add Comment
Please, Sign In to add comment