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.3.1
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000167" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.2.6, 7.3.0
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000098" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.2.13
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000105" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.1.0, 7.2.12
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000131" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.2.11
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000124" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.2.10
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000092" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.2.9
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000115" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.2.8
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000207" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.2.7
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000193" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.2.5
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000186" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.1.20, 7.2.4
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000120" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.1.24, 7.2.3
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000133" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.2.2
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000108" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.2.1
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000149" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.1.14, 7.2.0
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000168" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.1.25
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000224" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.1.23
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000174" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.1.22
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000100" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.1.21
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000197" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.1.19
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000187" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.1.15, 7.1.18
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000102" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.1.4, 7.1.17
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000107" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.1.16
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000093" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.1.13
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000161" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.1.12
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000143" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.1.11
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000195" ["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.000109" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.1.8 - 7.1.9
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000154" ["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.000142" ["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.000096" ["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.000206" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 5.4.30 - 5.4.45, 5.5.14 - 7.0.33, 7.1.3
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 7.1.2
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000134" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } }
Output for 7.1.1
array(1) { ["created"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-02 11:18:50.000178" ["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" } }