3v4l.org

run code in 200+ php & hhvm versions
<?php $foo = json_decode('[bar'); // many lines of code. $bar = json_encode('Hello world!', JSON_THROW_ON_ERROR); if (json_last_error() !== JSON_ERROR_NONE) { throw new Exception("encoding went wrong!"); } echo "All is fine";
Output for 7.3.0 - 7.3.5
Fatal error: Uncaught Exception: encoding went wrong! in /in/JJD5g:9 Stack trace: #0 {main} thrown in /in/JJD5g on line 9
Process exited with code 255.
Output for 7.2.0 - 7.2.18
Warning: Use of undefined constant JSON_THROW_ON_ERROR - assumed 'JSON_THROW_ON_ERROR' (this will throw an Error in a future version of PHP) in /in/JJD5g on line 7 Warning: json_encode() expects parameter 2 to be integer, string given in /in/JJD5g on line 7 Fatal error: Uncaught Exception: encoding went wrong! in /in/JJD5g:9 Stack trace: #0 {main} thrown in /in/JJD5g on line 9
Process exited with code 255.
Output for 7.1.25 - 7.1.28
Notice: Use of undefined constant JSON_THROW_ON_ERROR - assumed 'JSON_THROW_ON_ERROR' in /in/JJD5g on line 7 Warning: json_encode() expects parameter 2 to be integer, string given in /in/JJD5g on line 7 Fatal error: Uncaught Exception: encoding went wrong! in /in/JJD5g:9 Stack trace: #0 {main} thrown in /in/JJD5g on line 9
Process exited with code 255.