3v4l.org

run code in 200+ PHP versions simultaneously
<?php var_dump(json_encode('ok', JSON_THROW_ON_ERROR, 512));
based on dEn2f
Output for 7.3.0 - 7.4.0rc4
string(4) ""ok""
Output for 7.2.0 - 7.2.23
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/ku5AH on line 3 Warning: json_encode() expects parameter 2 to be integer, string given in /in/ku5AH on line 3 NULL
Output for 7.1.25 - 7.1.32
Notice: Use of undefined constant JSON_THROW_ON_ERROR - assumed 'JSON_THROW_ON_ERROR' in /in/ku5AH on line 3 Warning: json_encode() expects parameter 2 to be integer, string given in /in/ku5AH on line 3 NULL