3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $test = new DateTime(''); $a = (array) $test; $new = DateTime::__set_state($a); var_dump($new);
based on JYmdM
Output for 7.2.0
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-05 22:59:44.003883" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.10
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-05 22:59:44.002978" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.7
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-05 22:59:44.004249" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.6
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-05 22:59:44.012063" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.5
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-05 22:59:44.008214" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.0
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-05 22:59:44.003989" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.28, 7.0.20
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-05 22:59:44.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.6
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-21 13:23:15.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.5
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-03 09:25:08.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.4
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-10 21:31:38.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.3
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-18 22:55:43.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.2
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-23 05:08:57.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.1
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-24 08:16:03.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.0
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-27 10:09:22.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.21
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-02 16:18:12.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.20
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-10 08:27:01.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.19
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-08 05:39:52.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.18
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-15 14:36:58.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.17
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-20 02:09:16.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.16
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-28 10:58:38.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.15
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-29 11:47:55.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.14
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-14 17:30:26.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.13
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-15 18:09:31.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.12
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-20 08:38:29.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.11
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-24 15:04:40.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.10
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-25 17:10:30.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.9
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-27 22:36:29.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.8
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-30 07:06:38.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.35
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-23 02:17:04.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.34
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-11 10:40:52.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.33
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-09 08:38:42.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.32
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-17 18:33:35.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.31
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-21 05:18:09.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.30
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-01 13:40:01.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.29
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-17 08:27:21.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.28
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-21 11:57:03.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.27
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-22 13:35:37.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.26
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-26 19:51:10.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.25
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-29 03:16:49.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.24
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-24 09:40:04.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.45
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-05 22:59:48.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.44
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-05 22:59:49.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.42 - 5.4.43
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-05 22:59:50.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.41
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-05 22:59:51.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.39 - 5.4.40
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-05 22:59:52.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.36 - 5.4.38
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-05 22:59:53.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.34 - 5.4.35
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-05 22:59:54.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.31 - 5.4.32
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-05 22:59:55.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.30
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-05 22:59:56.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.28 - 5.4.29
object(DateTime)#2 (3) { ["date"]=> string(19) "2016-01-05 22:59:56" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.24 - 5.4.27
object(DateTime)#2 (3) { ["date"]=> string(19) "2016-01-05 22:59:57" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.3.28, 5.4.21 - 5.4.23
object(DateTime)#2 (3) { ["date"]=> string(19) "2016-01-05 22:59:58" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.18 - 5.4.20
object(DateTime)#2 (3) { ["date"]=> string(19) "2016-01-05 22:59:59" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.3.25 - 5.3.27, 5.4.15 - 5.4.17
object(DateTime)#2 (3) { ["date"]=> string(19) "2016-01-05 23:00:00" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.3.22 - 5.3.24, 5.4.12 - 5.4.14
object(DateTime)#2 (3) { ["date"]=> string(19) "2016-01-05 23:00:01" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.3.21, 5.4.11
object(DateTime)#2 (3) { ["date"]=> string(19) "2016-01-05 23:00:02" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.3.29
object(DateTime)#2 (3) { ["date"]=> string(19) "2016-01-05 22:59:55" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }