3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php var_dump(new \DateTime('Y'));
based on Ykr6T
Output for 7.2.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-10-15 15:33:12.002609" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 7.1.10
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-10-15 15:33:12.005688" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 7.1.7
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-10-15 15:33:12.003493" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 7.1.6
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-10-15 15:33:12.011104" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 7.1.5
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-10-15 15:33:12.008175" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 7.1.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-10-15 15:33:12.003968" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.6.28, 7.0.20
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-10-15 15:33:12.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 7.0.6
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-03 12:10:45.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 7.0.5
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-03 00:54:45.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 7.0.4
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-10 11:37:21.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 7.0.3
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-18 12:20:51.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 7.0.2
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-22 18:18:35.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 7.0.1
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-23 22:42:05.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 7.0.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-27 00:11:40.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.6.21
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-02 07:24:10.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.6.20
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-09 23:45:49.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.6.19
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-07 19:39:29.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.6.18
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-15 04:13:17.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.6.17
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-19 16:29:45.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.6.16
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-28 02:09:25.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.6.15
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-29 03:05:03.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.6.14
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-02 05:16:35.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.6.13
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-15 09:15:33.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.6.12
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-19 23:12:51.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.6.11
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-23 06:08:58.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.6.10
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-25 07:55:34.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.6.9
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-27 12:59:08.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.6.8
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-29 21:09:34.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.5.35
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-22 11:10:34.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.5.34
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-11 02:07:06.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.5.33
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-08 22:37:39.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.5.32
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-17 06:12:02.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.5.31
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-20 19:13:10.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.5.30
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-01 04:59:31.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.5.29
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-16 23:23:30.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.5.28
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-21 02:32:40.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.5.27
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-22 04:49:54.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.5.26
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-26 10:27:31.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.5.25
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-28 16:54:13.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.5.24
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-24 00:01:13.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.4.43 - 5.4.45
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-10-15 15:33:24.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.4.37 - 5.4.42
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-10-15 15:33:25.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.4.30 - 5.4.36
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-10-15 15:33:26.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.4.29
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-10-15 15:33:26" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.4.22 - 5.4.28
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-10-15 15:33:27" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.4.15 - 5.4.21
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-10-15 15:33:28" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.4.8 - 5.4.14
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-10-15 15:33:29" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.4.7
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-10-27 01:59:50" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.4.6
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-10-27 03:28:37" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.4.5
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-10-27 04:58:54" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.4.4
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-10-27 06:36:00" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.4.3
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-10-27 08:17:24" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.4.2
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-10-27 10:02:18" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.3.29
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-10-31 05:57:19" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.3.28
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-10-31 08:05:56" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.3.27
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-10-31 10:13:00" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.3.26
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-11-02 09:08:57" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.3.25
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-11-02 10:41:46" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.3.24
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-11-02 11:53:17" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.3.23
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-11-02 13:27:22" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.3.22
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-11-02 15:00:33" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.3.21
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-11-02 16:00:51" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.3.20
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-11-02 17:00:59" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.3.19
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-11-02 18:26:31" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }
Output for 5.3.18
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-11-02 18:33:12" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Y" }