3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array['test'] = 4; $array['test2']['test'] = 'test'; $array['test2']['test3'] = 'test4'; print_r($array); $json_array = json_encode($array); print_r($json_array); $json_array_decode = json_decode($json_array); print_r($json_array_decode);
based on SseFF
Output for 5.2.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [test] => 4 [test2] => Array ( [test] => test [test3] => test4 ) ) {"test":4,"test2":{"test":"test","test3":"test4"}}stdClass Object ( [test] => 4 [test2] => stdClass Object ( [test] => test [test3] => test4 ) )
Output for 5.0.0 - 5.1.6
Array ( [test] => 4 [test2] => Array ( [test] => test [test3] => test4 ) ) Fatal error: Call to undefined function json_encode() in /in/9Eh7q on line 9
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Array ( [test] => 4 [test2] => Array ( [test] => test [test3] => test4 ) ) Fatal error: Call to undefined function: json_encode() in /in/9Eh7q on line 9
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Array ( [test] => 4 [test2] => Array ( [test] => test [test3] => test4 ) ) Fatal error: Call to undefined function: json_encode() in /in/9Eh7q on line 9
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Array ( [test] => 4 [test2] => Array ( [test] => test [test3] => test4 ) ) Fatal error: Call to undefined function: json_encode() in /in/9Eh7q on line 9