3v4l.org

run code in 300+ PHP versions simultaneously
<?php $v = json_decode('[{"id":"1","name":"Jack","username":"Jack1","age":"23"}]'); echo 'Normal:' . \PHP_EOL; echo json_encode($v) . \PHP_EOL . \PHP_EOL; echo 'Force Object and Numeric Check:' . \PHP_EOL; echo json_encode($v, JSON_FORCE_OBJECT | JSON_NUMERIC_CHECK). \PHP_EOL . \PHP_EOL; echo 'Normal reset:' . \PHP_EOL; echo json_encode(reset($v)) . \PHP_EOL . \PHP_EOL; echo 'Force Object and Numeric Check reset:' . \PHP_EOL; echo json_encode(reset($v), JSON_FORCE_OBJECT | JSON_NUMERIC_CHECK);
Output for 5.3.3 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.27, 8.4.1 - 8.4.14
Normal: [{"id":"1","name":"Jack","username":"Jack1","age":"23"}] Force Object and Numeric Check: {"0":{"id":1,"name":"Jack","username":"Jack1","age":23}} Normal reset: {"id":"1","name":"Jack","username":"Jack1","age":"23"} Force Object and Numeric Check reset: {"id":1,"name":"Jack","username":"Jack1","age":23}
Output for 5.3.0 - 5.3.2
Normal: [{"id":"1","name":"Jack","username":"Jack1","age":"23"}] Force Object and Numeric Check: Notice: Use of undefined constant JSON_NUMERIC_CHECK - assumed 'JSON_NUMERIC_CHECK' in /in/ip6GN on line 8 {"0":{"id":"1","name":"Jack","username":"Jack1","age":"23"}} Normal reset: {"id":"1","name":"Jack","username":"Jack1","age":"23"} Force Object and Numeric Check reset: Notice: Use of undefined constant JSON_NUMERIC_CHECK - assumed 'JSON_NUMERIC_CHECK' in /in/ip6GN on line 13 {"id":"1","name":"Jack","username":"Jack1","age":"23"}
Output for 5.2.0 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 5 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 7 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 8 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 8 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 10 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 11 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 11 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 12 Normal: [{"id":"1","name":"Jack","username":"Jack1","age":"23"}] Force Object and Numeric Check: Notice: Use of undefined constant JSON_FORCE_OBJECT - assumed 'JSON_FORCE_OBJECT' in /in/ip6GN on line 8 Notice: Use of undefined constant JSON_NUMERIC_CHECK - assumed 'JSON_NUMERIC_CHECK' in /in/ip6GN on line 8 Warning: json_encode() expects exactly 1 parameter, 2 given in /in/ip6GN on line 8 Normal reset: {"id":"1","name":"Jack","username":"Jack1","age":"23"} Force Object and Numeric Check reset: Notice: Use of undefined constant JSON_FORCE_OBJECT - assumed 'JSON_FORCE_OBJECT' in /in/ip6GN on line 13 Notice: Use of undefined constant JSON_NUMERIC_CHECK - assumed 'JSON_NUMERIC_CHECK' in /in/ip6GN on line 13 Warning: json_encode() expects exactly 1 parameter, 2 given in /in/ip6GN on line 13
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 5 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 7 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 8 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 8 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 10 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 11 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 11 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 12 Fatal error: Call to undefined function json_decode() in /in/ip6GN on line 3
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 5 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 7 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 8 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 8 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 10 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 11 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 11 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 12 Fatal error: Call to undefined function: json_decode() in /in/ip6GN on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 5 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 7 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 8 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 8 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 10 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 11 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 11 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 12 Fatal error: Call to undefined function: json_decode() in /in/ip6GN on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 5 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 7 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 8 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 8 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 10 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 11 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 11 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ip6GN on line 12 Fatal error: Call to undefined function: json_decode() in /in/ip6GN on line 3

preferences:
171.67 ms | 419 KiB | 5 Q