3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $brokenJson = '[{"test":"}]'; $res = json_decode($brokenJson, true); if (json_last_error() != JSON_ERROR_NONE) { throw new Exception(json_last_error_msg(), json_last_error()); } var_dump($res);
based on hPRhE
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Exception: Control character error, possibly incorrectly encoded in /in/ttU4E:8 Stack trace: #0 {main} thrown in /in/ttU4E on line 8
Process exited with code 255.
Output for 5.5.24 - 5.6.28
Fatal error: Uncaught exception 'Exception' with message 'Syntax error' in /in/ttU4E:8 Stack trace: #0 {main} thrown in /in/ttU4E on line 8
Process exited with code 255.
Output for 5.3.19 - 5.4.45
Fatal error: Call to undefined function json_last_error_msg() in /in/ttU4E on line 8
Process exited with code 255.