3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { public static $bar; public function getBar() { if (empty(self::$bar)) { self::$bar = new \DateTime(); } return self::$bar; } } var_dump(Foo::$bar); $a = new Foo(); $a->getBar(); var_dump(Foo::$bar);
Output for 7.2.0
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-14 11:27:08.005495" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.10
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-14 11:27:08.003370" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.7
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-14 11:27:08.002941" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.6
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-14 11:27:08.008456" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.5
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-14 11:27:08.010849" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.0
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-14 11:27:08.004040" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.28, 7.0.20
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-14 11:27:08.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.6
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-21 13:48:13.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.5
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-03 09:46:01.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.4
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-10 21:53:14.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.3
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-18 23:20:37.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.2
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-23 05:34:32.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.1
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-24 08:38:04.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.0
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-27 10:31:02.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.21
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-02 16:40:07.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.20
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-10 08:48:17.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.19
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-08 06:02:52.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.18
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-15 15:00:56.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.17
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-20 02:33:30.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.16
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-28 11:20:50.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.15
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-29 12:10:26.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.14
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-14 17:52:51.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.13
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-15 18:31:56.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.12
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-20 09:01:34.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.11
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-24 15:27:54.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.10
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-25 17:33:28.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.9
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-27 23:00:04.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.8
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-30 07:28:32.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.35
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-23 02:43:49.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.34
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-11 11:02:16.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.33
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-09 09:01:51.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.32
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-17 18:58:48.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.31
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-21 05:45:07.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.30
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-01 14:01:36.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.29
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-17 08:49:32.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.28
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-21 12:21:23.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.27
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-22 13:58:56.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.26
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-26 20:14:59.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.25
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-29 03:41:08.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.24
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-24 10:12:31.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.45
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-14 11:27:11.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.44
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-14 11:27:12.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.41 - 5.4.43
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-14 11:27:13.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.40
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-14 11:27:14.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.38 - 5.4.39
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-14 11:27:15.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.35 - 5.4.37
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-14 11:27:16.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.34
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-14 11:27:17.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.30 - 5.4.32
NULL object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-14 11:27:18.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.26 - 5.4.29
NULL object(DateTime)#2 (3) { ["date"]=> string(19) "2016-01-14 11:27:19" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.23 - 5.4.25
NULL object(DateTime)#2 (3) { ["date"]=> string(19) "2016-01-14 11:27:20" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.3.28, 5.4.20 - 5.4.22
NULL object(DateTime)#2 (3) { ["date"]=> string(19) "2016-01-14 11:27:21" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.3.27, 5.4.17 - 5.4.19
NULL object(DateTime)#2 (3) { ["date"]=> string(19) "2016-01-14 11:27:22" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.3.24 - 5.3.26, 5.4.13 - 5.4.16
NULL object(DateTime)#2 (3) { ["date"]=> string(19) "2016-01-14 11:27:23" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.3.21 - 5.3.23, 5.4.11 - 5.4.12
NULL object(DateTime)#2 (3) { ["date"]=> string(19) "2016-01-14 11:27:24" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.3.29
NULL object(DateTime)#2 (3) { ["date"]=> string(19) "2016-01-14 11:27:18" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }