3v4l.org

run code in 200+ PHP versions simultaneously
<?php $d = new \DateTime(); var_dump($d) ;var_dump($d->modify('+2 years'));
based on SesKo
Output for 7.4.0rc1, 7.4.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000225" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000225" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.4.0rc6
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000266" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000266" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.4.0rc5
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000278" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000278" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.3.10, 7.4.0rc4
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000299" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000299" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.4.0rc3
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000243" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000243" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.4.0rc2
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000249" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000249" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.4.0beta4
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000250" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000250" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.4.0beta2
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000241" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000241" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.4.0beta1
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000219" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000219" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.2.21, 7.4.0alpha3
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000310" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000310" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.4.0alpha2
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000201" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000201" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.29, 7.3.0, 7.4.0alpha1
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000215" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000215" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.3.12
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000212" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000212" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.3.11
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000218" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000218" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.3.6, 7.3.9
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000230" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000230" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.3.8
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000308" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000308" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.3.7
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000223" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000223" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.3.5
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000238" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000238" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.3.4
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000272" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000272" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.3.3
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000252" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000252" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.3.2
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000206" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000206" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.2.25, 7.3.1
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000247" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000247" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.2.24
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000259" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000259" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.2.23
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000289" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000289" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.31, 7.2.22
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000328" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000328" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.2.20
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000208" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000208" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.2.19
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000279" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000279" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.2.17 - 7.2.18
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000224" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000224" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.33
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.002040" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.002040" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.32
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000246" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000246" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.30
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000286" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000286" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.28
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000233" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000233" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.27
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000315" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000315" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.26
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-12-03 08:40:05.000298" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2021-12-03 08:40:05.000298" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }