3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $datetime1 = new DateTime('20150915'); $datetime2 = new DateTime("now"); $interval = $datetime1->diff($datetime2); print_r($interval->y); print_r($datetime2);
based on 1bA1J
Output for 7.2.0
0DateTime Object ( [date] => 2015-12-03 08:16:17.004640 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.1.10
0DateTime Object ( [date] => 2015-12-03 08:16:17.003904 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.1.7
0DateTime Object ( [date] => 2015-12-03 08:16:17.002554 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.1.6
0DateTime Object ( [date] => 2015-12-03 08:16:17.013505 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.1.5
0DateTime Object ( [date] => 2015-12-03 08:16:17.010109 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.1.0
0DateTime Object ( [date] => 2015-12-03 08:16:17.004892 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.6.28, 7.0.20
0DateTime Object ( [date] => 2015-12-03 08:16:17.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.6
0DateTime Object ( [date] => 2016-05-03 19:57:47.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.5
0DateTime Object ( [date] => 2016-04-03 08:17:09.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.4
0DateTime Object ( [date] => 2016-03-10 20:12:10.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.3
0DateTime Object ( [date] => 2016-03-18 21:33:55.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.2
0DateTime Object ( [date] => 2016-03-23 03:47:57.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.1
0DateTime Object ( [date] => 2016-03-24 07:04:00.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.0
0DateTime Object ( [date] => 2016-03-27 08:58:15.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.6.21
0DateTime Object ( [date] => 2016-05-02 15:06:15.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.6.20
0DateTime Object ( [date] => 2016-04-10 07:18:32.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.6.19
0DateTime Object ( [date] => 2016-03-08 04:25:13.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.6.18
0DateTime Object ( [date] => 2016-03-15 13:16:03.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.6.17
0DateTime Object ( [date] => 2016-03-20 00:50:19.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.6.16
0DateTime Object ( [date] => 2016-03-28 09:47:25.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.6.15
0DateTime Object ( [date] => 2016-03-29 10:36:52.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.6.14
0DateTime Object ( [date] => 2016-04-14 16:17:48.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.6.13
0DateTime Object ( [date] => 2016-04-15 16:58:13.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.6.12
0DateTime Object ( [date] => 2016-04-20 07:25:25.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.6.11
0DateTime Object ( [date] => 2016-04-24 13:50:06.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.6.10
0DateTime Object ( [date] => 2016-04-25 15:54:03.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.6.9
0DateTime Object ( [date] => 2016-04-27 21:02:34.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.6.8
0DateTime Object ( [date] => 2016-04-30 05:53:02.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.5.35
0DateTime Object ( [date] => 2016-05-23 00:06:45.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.5.34
0DateTime Object ( [date] => 2016-04-11 09:29:56.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.5.33
0DateTime Object ( [date] => 2016-03-09 07:18:15.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.5.32
0DateTime Object ( [date] => 2016-03-17 17:08:48.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.5.31
0DateTime Object ( [date] => 2016-03-21 03:56:02.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.5.30
0DateTime Object ( [date] => 2016-04-01 12:29:36.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.5.29
0DateTime Object ( [date] => 2016-04-17 07:16:22.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.5.28
0DateTime Object ( [date] => 2016-04-21 10:41:05.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.5.27
0DateTime Object ( [date] => 2016-04-22 12:23:56.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.5.26
0DateTime Object ( [date] => 2016-04-26 18:34:27.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.5.25
0DateTime Object ( [date] => 2016-04-29 01:58:03.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.5.24
0DateTime Object ( [date] => 2016-05-24 08:09:07.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.4.44 - 5.4.45
0DateTime Object ( [date] => 2015-12-03 08:16:20.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.4.43
0DateTime Object ( [date] => 2015-12-03 08:16:21.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.4.41 - 5.4.42
0DateTime Object ( [date] => 2015-12-03 08:16:22.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.4.39 - 5.4.40
0DateTime Object ( [date] => 2015-12-03 08:16:23.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.4.36 - 5.4.38
0DateTime Object ( [date] => 2015-12-03 08:16:24.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.4.34 - 5.4.35
0DateTime Object ( [date] => 2015-12-03 08:16:25.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.4.30 - 5.4.32
0DateTime Object ( [date] => 2015-12-03 08:16:26.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.3.29, 5.4.29
0DateTime Object ( [date] => 2015-12-03 08:16:26 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.4.25 - 5.4.28
0DateTime Object ( [date] => 2015-12-03 08:16:27 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.3.28, 5.4.21 - 5.4.24
0DateTime Object ( [date] => 2015-12-03 08:16:28 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.3.27, 5.4.17 - 5.4.20
0DateTime Object ( [date] => 2015-12-03 08:16:29 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.3.23 - 5.3.26, 5.4.13 - 5.4.16
0DateTime Object ( [date] => 2015-12-03 08:16:30 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.3.20 - 5.3.22, 5.4.10 - 5.4.12
0DateTime Object ( [date] => 2015-12-03 08:16:31 [timezone_type] => 3 [timezone] => Europe/Amsterdam )