3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = new DateTime(); $json = json_encode(array('a' => $a)); var_dump($a); $b = json_decode($json, true)['a']; var_dump(DateTime::__set_state($b));
Output for 7.2.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-30 18:46:28.004757" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-12-30 18:46:28.004757" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.10
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-30 18:46:28.003240" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-12-30 18:46:28.003240" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.7
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-30 18:46:28.002503" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-12-30 18:46:28.002503" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.6
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-30 18:46:28.011892" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-12-30 18:46:28.011892" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.5
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-30 18:46:28.011265" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-12-30 18:46:28.011265" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-30 18:46:28.003870" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-12-30 18:46:28.003870" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.14 - 7.0.20
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-30 18:46:28.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-12-30 18:46:28.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.0 - 5.5.13
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-12-30 18:46:28" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(19) "2015-12-30 18:46:28" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }