3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $old = ['created' => new \DateTime()]; $new = ['created' => new \DateTime('+1 minute')]; $changeset = array_replace_recursive($old, $new); var_dump($changeset);
based on oufFj
Output for 7.2.0
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.004440" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.1.10
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.004291" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.1.7
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.004756" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.1.6
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.012704" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.1.5
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.011391" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.1.0
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.004076" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 5.4.30 - 5.4.45, 5.5.14 - 7.0.20
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 5.4.0 - 5.4.29, 5.5.0 - 5.5.13
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(19) "2015-11-02 11:18:50" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }