3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php date_default_timezone_set('Australia/Perth'); $d=new DateTime(); var_dump(json_encode($d)); var_dump(serialize($d));
Output for 7.2.6
string(85) "{"date":"2014-06-20 09:54:38.003390","timezone_type":3,"timezone":"Australia\/Perth"}" string(127) "O:8:"DateTime":3:{s:4:"date";s:26:"2014-06-20 09:54:38.003390";s:13:"timezone_type";i:3;s:8:"timezone";s:15:"Australia/Perth";}"
Output for 7.2.0
string(85) "{"date":"2014-06-20 09:54:38.002601","timezone_type":3,"timezone":"Australia\/Perth"}" string(127) "O:8:"DateTime":3:{s:4:"date";s:26:"2014-06-20 09:54:38.002601";s:13:"timezone_type";i:3;s:8:"timezone";s:15:"Australia/Perth";}"
Output for 7.1.20
string(85) "{"date":"2014-06-20 09:54:38.003263","timezone_type":3,"timezone":"Australia\/Perth"}" string(127) "O:8:"DateTime":3:{s:4:"date";s:26:"2014-06-20 09:54:38.003263";s:13:"timezone_type";i:3;s:8:"timezone";s:15:"Australia/Perth";}"
Output for 7.1.10
string(85) "{"date":"2014-06-20 09:54:38.004648","timezone_type":3,"timezone":"Australia\/Perth"}" string(127) "O:8:"DateTime":3:{s:4:"date";s:26:"2014-06-20 09:54:38.004648";s:13:"timezone_type";i:3;s:8:"timezone";s:15:"Australia/Perth";}"
Output for 7.1.7
string(85) "{"date":"2014-06-20 09:54:38.005228","timezone_type":3,"timezone":"Australia\/Perth"}" string(127) "O:8:"DateTime":3:{s:4:"date";s:26:"2014-06-20 09:54:38.005228";s:13:"timezone_type";i:3;s:8:"timezone";s:15:"Australia/Perth";}"
Output for 7.1.6
string(85) "{"date":"2014-06-20 09:54:38.010572","timezone_type":3,"timezone":"Australia\/Perth"}" string(127) "O:8:"DateTime":3:{s:4:"date";s:26:"2014-06-20 09:54:38.010572";s:13:"timezone_type";i:3;s:8:"timezone";s:15:"Australia/Perth";}"
Output for 7.1.5
string(85) "{"date":"2014-06-20 09:54:38.008638","timezone_type":3,"timezone":"Australia\/Perth"}" string(127) "O:8:"DateTime":3:{s:4:"date";s:26:"2014-06-20 09:54:38.008638";s:13:"timezone_type";i:3;s:8:"timezone";s:15:"Australia/Perth";}"
Output for 7.1.0
string(85) "{"date":"2014-06-20 09:54:38.004123","timezone_type":3,"timezone":"Australia\/Perth"}" string(127) "O:8:"DateTime":3:{s:4:"date";s:26:"2014-06-20 09:54:38.004123";s:13:"timezone_type";i:3;s:8:"timezone";s:15:"Australia/Perth";}"
Output for 5.4.30 - 5.4.45, 5.5.14 - 7.0.20
string(85) "{"date":"2014-06-20 09:54:38.000000","timezone_type":3,"timezone":"Australia\/Perth"}" string(127) "O:8:"DateTime":3:{s:4:"date";s:26:"2014-06-20 09:54:38.000000";s:13:"timezone_type";i:3;s:8:"timezone";s:15:"Australia/Perth";}"
Output for 5.3.0 - 5.4.29, 5.5.0 - 5.5.13
string(78) "{"date":"2014-06-20 09:54:38","timezone_type":3,"timezone":"Australia\/Perth"}" string(120) "O:8:"DateTime":3:{s:4:"date";s:19:"2014-06-20 09:54:38";s:13:"timezone_type";i:3;s:8:"timezone";s:15:"Australia/Perth";}"
Output for 5.2.0 - 5.2.17
string(2) "{}" string(19) "O:8:"DateTime":0:{}"
Output for 5.1.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/lbQ9Z on line 4
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/lbQ9Z 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/lbQ9Z 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/lbQ9Z 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/lbQ9Z on line 3