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, 1); var_dump(json_last_error(), json_last_error_msg());
Output for 7.1.0
{"date":"2014-06-19 23:00:47.004008","timezone_type":3,"timezone":"America\/New_York"}int(0) string(8) "No error"
Output for 5.5.14 - 7.0.14
{"date":"2014-06-19 23:00:47.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 23:00:47","timezone_type":3,"timezone":"America\/New_York"}int(0) string(8) "No error"
Output for 5.4.30 - 5.4.45
{"date":"2014-06-19 23:00:47.000000","timezone_type":3,"timezone":"America\/New_York"} Fatal error: Call to undefined function json_last_error_msg() in /in/Cl7ta on line 9
Process exited with code 255.
Output for 5.3.0 - 5.4.29
{"date":"2014-06-19 23:00:47","timezone_type":3,"timezone":"America\/New_York"} Fatal error: Call to undefined function json_last_error_msg() in /in/Cl7ta on line 9
Process exited with code 255.
Output for 5.2.0 - 5.2.17
Warning: json_encode() expects exactly 1 parameter, 2 given in /in/Cl7ta on line 8 Fatal error: Call to undefined function json_last_error() in /in/Cl7ta on line 9
Process exited with code 255.
Output for 5.1.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/Cl7ta 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/Cl7ta 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/Cl7ta 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/Cl7ta 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/Cl7ta on line 3