3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php if (class_exists('DateTimeImmutable')) { $date = new DateTimeImmutable('2015-01-01 00:00:00.123456'); echo serialize($date), PHP_EOL; echo json_encode($date), PHP_EOL; } if (class_exists('DateTime')) { $date = new DateTime('2015-01-01 00:00:00.123456'); echo serialize($date), PHP_EOL; echo json_encode($date), PHP_EOL; }
based on Orcre
Output for 5.5.14 - 7.2.0
O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-01-01 00:00:00.123456";s:13:"timezone_type";i:3;s:8:"timezone";s:16:"Europe/Amsterdam";} {"date":"2015-01-01 00:00:00.123456","timezone_type":3,"timezone":"Europe\/Amsterdam"} O:8:"DateTime":3:{s:4:"date";s:26:"2015-01-01 00:00:00.123456";s:13:"timezone_type";i:3;s:8:"timezone";s:16:"Europe/Amsterdam";} {"date":"2015-01-01 00:00:00.123456","timezone_type":3,"timezone":"Europe\/Amsterdam"}
Output for 5.5.0 - 5.5.13
O:17:"DateTimeImmutable":3:{s:4:"date";s:19:"2015-01-01 00:00:00";s:13:"timezone_type";i:3;s:8:"timezone";s:16:"Europe/Amsterdam";} {"date":"2015-01-01 00:00:00","timezone_type":3,"timezone":"Europe\/Amsterdam"} O:8:"DateTime":3:{s:4:"date";s:19:"2015-01-01 00:00:00";s:13:"timezone_type";i:3;s:8:"timezone";s:16:"Europe/Amsterdam";} {"date":"2015-01-01 00:00:00","timezone_type":3,"timezone":"Europe\/Amsterdam"}
Output for 5.4.30 - 5.4.45
O:8:"DateTime":3:{s:4:"date";s:26:"2015-01-01 00:00:00.123456";s:13:"timezone_type";i:3;s:8:"timezone";s:16:"Europe/Amsterdam";} {"date":"2015-01-01 00:00:00.123456","timezone_type":3,"timezone":"Europe\/Amsterdam"}
Output for 5.3.0 - 5.4.29
O:8:"DateTime":3:{s:4:"date";s:19:"2015-01-01 00:00:00";s:13:"timezone_type";i:3;s:8:"timezone";s:16:"Europe/Amsterdam";} {"date":"2015-01-01 00:00:00","timezone_type":3,"timezone":"Europe\/Amsterdam"}
Output for 5.2.0 - 5.2.17
O:8:"DateTime":0:{} {}
Output for 4.3.0 - 5.1.6