3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php date_default_timezone_set('America/New_York'); $date = new DateTime(); echo json_encode($date, JSON_PARTIAL_OUTPUT_ON_ERROR); var_dump(json_last_error(), json_last_error_msg());
Output for 7.1.0
{"date":"2014-06-19 22:59:59.004024","timezone_type":3,"timezone":"America\/New_York"}int(0) string(8) "No error"
Output for 5.5.14 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.0.14
{"date":"2014-06-19 22:59:59.000000","timezone_type":3,"timezone":"America\/New_York"}int(0) string(8) "No error"
Output for 5.5.0 - 5.5.13
{"date":"2014-06-19 22:59:59","timezone_type":3,"timezone":"America\/New_York"}int(0) string(8) "No error"
Output for 5.3.0 - 5.3.13, 5.3.15 - 5.4.45
Notice: Use of undefined constant JSON_PARTIAL_OUTPUT_ON_ERROR - assumed 'JSON_PARTIAL_OUTPUT_ON_ERROR' in /in/ZFUY5 on line 8 Warning: json_encode() expects parameter 2 to be long, string given in /in/ZFUY5 on line 8 Fatal error: Call to undefined function json_last_error_msg() in /in/ZFUY5 on line 9
Process exited with code 255.
Output for 5.3.14
{"date":"2014-06-19 22:59:59","timezone_type":3,"timezone":"America\/New_York"} Fatal error: Call to undefined function json_last_error_msg() in /in/ZFUY5 on line 9
Process exited with code 255.
Output for 5.2.0 - 5.2.17
Notice: Use of undefined constant JSON_PARTIAL_OUTPUT_ON_ERROR - assumed 'JSON_PARTIAL_OUTPUT_ON_ERROR' in /in/ZFUY5 on line 8 Warning: json_encode() expects exactly 1 parameter, 2 given in /in/ZFUY5 on line 8 Fatal error: Call to undefined function json_last_error() in /in/ZFUY5 on line 9
Process exited with code 255.
Output for 5.1.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/ZFUY5 on line 5
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Fatal error: Call to undefined function date_default_timezone_set() in /in/ZFUY5 on line 3
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: date_default_timezone_set() in /in/ZFUY5 on line 3
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: date_default_timezone_set() in /in/ZFUY5 on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: date_default_timezone_set() in /in/ZFUY5 on line 3