3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump(defined('JSON_C_VERSION') ? JSON_C_VERSION : NULL); var_dump(PHP_INT_SIZE); echo "JSON_BIGINT_AS_STRING:\n"; var_dump(json_decode('[12345678901234567890]', TRUE, 512, JSON_BIGINT_AS_STRING)); var_dump(json_last_error()); var_dump(PHP_VERSION_ID >= 50500 ? json_last_error_msg() : '?'); echo "Invalid UTF-8 input:\n"; var_dump(json_decode("\"\xff\"")); var_dump(json_last_error()); var_dump(PHP_VERSION_ID >= 50500 ? json_last_error_msg() : '?'); echo "Valid UTF-8 input, but the result can not be (lead surrogate followed by lead surrogate):\n"; var_dump(json_decode('"\uD811\uD811"')); var_dump(json_last_error()); var_dump(PHP_VERSION_ID >= 50500 ? json_last_error_msg() : '?'); echo "Fatal error:\n"; var_dump(json_decode('{"\u0000": 1}')); var_dump(json_last_error()); var_dump(PHP_VERSION_ID >= 50500 ? json_last_error_msg() : '?');
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.6 - 7.2.33, 7.3.12 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
NULL int(8) JSON_BIGINT_AS_STRING: array(1) { [0]=> string(20) "12345678901234567890" } int(0) string(8) "No error" Invalid UTF-8 input: NULL int(5) string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" Valid UTF-8 input, but the result can not be (lead surrogate followed by lead surrogate): NULL int(10) string(50) "Single unpaired UTF-16 surrogate in unicode escape" Fatal error: NULL int(9) string(36) "The decoded property name is invalid"
Output for 5.5.24 - 5.5.35, 5.6.7 - 5.6.28
NULL int(8) JSON_BIGINT_AS_STRING: array(1) { [0]=> string(20) "12345678901234567890" } int(0) string(8) "No error" Invalid UTF-8 input: NULL int(5) string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" Valid UTF-8 input, but the result can not be (lead surrogate followed by lead surrogate): string(6) "��" int(0) string(8) "No error" Fatal error: Fatal error: Cannot access property started with '\0' in /in/F1H6n on line 21
Process exited with code 255.
Output for 5.4.0 - 5.4.45
NULL int(8) JSON_BIGINT_AS_STRING: array(1) { [0]=> string(20) "12345678901234567890" } int(0) string(1) "?" Invalid UTF-8 input: NULL int(5) string(1) "?" Valid UTF-8 input, but the result can not be (lead surrogate followed by lead surrogate): string(6) "��" int(0) string(1) "?" Fatal error: Fatal error: Cannot access property started with '\0' in /in/F1H6n on line 21
Process exited with code 255.
Output for 5.3.3 - 5.3.29
NULL int(8) JSON_BIGINT_AS_STRING: Notice: Use of undefined constant JSON_BIGINT_AS_STRING - assumed 'JSON_BIGINT_AS_STRING' in /in/F1H6n on line 6 Warning: json_decode() expects at most 3 parameters, 4 given in /in/F1H6n on line 6 NULL int(0) string(1) "?" Invalid UTF-8 input: NULL int(5) string(1) "?" Valid UTF-8 input, but the result can not be (lead surrogate followed by lead surrogate): string(6) "��" int(0) string(1) "?" Fatal error: Fatal error: Cannot access property started with '\0' in /in/F1H6n on line 21
Process exited with code 255.
Output for 5.3.0 - 5.3.2
NULL int(8) JSON_BIGINT_AS_STRING: Notice: Use of undefined constant JSON_BIGINT_AS_STRING - assumed 'JSON_BIGINT_AS_STRING' in /in/F1H6n on line 6 Warning: json_decode() expects at most 3 parameters, 4 given in /in/F1H6n on line 6 NULL int(0) string(1) "?" Invalid UTF-8 input: NULL int(0) string(1) "?" Valid UTF-8 input, but the result can not be (lead surrogate followed by lead surrogate): string(6) "��" int(0) string(1) "?" Fatal error: Fatal error: Cannot access property started with '\0' in /in/F1H6n on line 21
Process exited with code 255.
Output for 5.2.0 - 5.2.17
NULL int(8) JSON_BIGINT_AS_STRING: Notice: Use of undefined constant JSON_BIGINT_AS_STRING - assumed 'JSON_BIGINT_AS_STRING' in /in/F1H6n on line 6 Warning: json_decode() expects at most 2 parameters, 4 given in /in/F1H6n on line 6 NULL Fatal error: Call to undefined function json_last_error() in /in/F1H6n on line 7
Process exited with code 255.
Output for 5.0.5, 5.1.0 - 5.1.6
NULL int(8) JSON_BIGINT_AS_STRING: Fatal error: Call to undefined function json_decode() in /in/F1H6n on line 6
Process exited with code 255.
Output for 5.0.0 - 5.0.4
NULL Notice: Use of undefined constant PHP_INT_SIZE - assumed 'PHP_INT_SIZE' in /in/F1H6n on line 3 string(12) "PHP_INT_SIZE" JSON_BIGINT_AS_STRING: Fatal error: Call to undefined function json_decode() in /in/F1H6n on line 6
Process exited with code 255.
Output for 4.4.5 - 4.4.9
NULL int(8) JSON_BIGINT_AS_STRING: Fatal error: Call to undefined function: json_decode() in /in/F1H6n on line 6
Process exited with code 255.
Output for 4.4.0 - 4.4.4
NULL int(8) JSON_BIGINT_AS_STRING: Fatal error: Call to undefined function: json_decode() in /in/F1H6n on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.11
NULL Notice: Use of undefined constant PHP_INT_SIZE - assumed 'PHP_INT_SIZE' in /in/F1H6n on line 3 string(12) "PHP_INT_SIZE" JSON_BIGINT_AS_STRING: Fatal error: Call to undefined function: json_decode() in /in/F1H6n on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1
NULL Notice: Use of undefined constant PHP_INT_SIZE - assumed 'PHP_INT_SIZE' in /in/F1H6n on line 3 string(12) "PHP_INT_SIZE" JSON_BIGINT_AS_STRING: Fatal error: Call to undefined function: json_decode() in /in/F1H6n on line 6

preferences:
211.98 ms | 401 KiB | 311 Q