3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $now = new DateTime("2014-04-07 15:30:00"); $diff = $now->diff(new DateTime()); var_dump(new DateTime()); echo $diff->format("%a");
Output for 7.1.0
object(DateTime)#2 (3) { ["date"]=> string(26) "2014-03-09 20:31:04.004989" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 28
Output for 5.6.28, 7.0.14
object(DateTime)#2 (3) { ["date"]=> string(26) "2014-03-09 20:31:04.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 28
Output for 7.0.6
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-03 14:21:38.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 756
Output for 7.0.5
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-03 03:01:04.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 726
Output for 7.0.4
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-10 14:15:21.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 702
Output for 7.0.3
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-18 14:51:28.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 710
Output for 7.0.2
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-22 20:53:06.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 715
Output for 7.0.1
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-24 01:28:50.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 716
Output for 7.0.0
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-27 03:28:12.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 719
Output for hhvm-3.12.0
object(DateTime)#4 (3) { ["date"]=> string(26) "2016-03-12 20:36:14.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 705
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.6.21
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-02 09:33:42.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 755
Output for 5.6.20
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-10 01:56:22.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 733
Output for 5.6.19
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-07 21:58:54.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 700
Output for 5.6.18
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-15 06:49:15.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 707
Output for 5.6.17
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-19 18:48:26.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 712
Output for 5.6.16
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-28 04:18:11.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 720
Output for 5.6.15
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-29 05:12:12.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 721
Output for 5.6.14
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-02 07:17:05.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 725
Output for 5.6.13
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-15 11:24:33.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 738
Output for 5.6.12
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-20 01:41:30.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 743
Output for 5.6.11
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-23 08:19:41.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 746
Output for 5.6.10
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-25 10:08:53.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 748
Output for 5.6.9
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-27 15:15:26.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 750
Output for 5.6.8
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-29 23:28:35.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 753
Output for 5.5.35
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-22 13:34:37.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 775
Output for 5.5.34
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-11 04:12:56.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 734
Output for 5.5.33
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-09 01:04:12.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 701
Output for 5.5.32
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-17 10:10:12.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 709
Output for 5.5.31
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-20 21:32:10.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 713
Output for 5.5.30
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-01 07:06:09.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 724
Output for 5.5.29
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-17 01:41:50.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 740
Output for 5.5.28
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-21 04:52:09.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 744
Output for 5.5.27
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-22 06:57:57.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 745
Output for 5.5.26
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-26 12:47:01.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 749
Output for 5.5.25
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-28 19:16:23.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 752
Output for 5.5.24
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-24 02:24:41.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 777
Output for 5.4.45
object(DateTime)#2 (3) { ["date"]=> string(26) "2015-09-16 16:21:55.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 527
Output for 5.4.44
object(DateTime)#2 (3) { ["date"]=> string(26) "2015-08-11 01:33:16.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 490
Output for 5.4.43
object(DateTime)#2 (3) { ["date"]=> string(26) "2015-07-10 19:35:53.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 459
Output for 5.4.42
object(DateTime)#2 (3) { ["date"]=> string(26) "2015-06-27 17:01:12.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 446
Output for 5.4.41
object(DateTime)#2 (3) { ["date"]=> string(26) "2015-05-25 23:24:51.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 413
Output for 5.4.40
object(DateTime)#2 (3) { ["date"]=> string(26) "2015-05-10 16:34:47.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 398
Output for 5.4.39
object(DateTime)#2 (3) { ["date"]=> string(26) "2015-05-10 16:34:46.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 398
Output for 5.4.38
object(DateTime)#2 (3) { ["date"]=> string(26) "2015-03-02 13:29:20.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 328
Output for 5.4.35 - 5.4.37
object(DateTime)#2 (3) { ["date"]=> string(26) "2015-02-08 09:16:49.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 306
Output for 5.4.34
object(DateTime)#2 (3) { ["date"]=> string(26) "2015-02-08 09:16:48.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 306
Output for 5.4.32
object(DateTime)#2 (3) { ["date"]=> string(26) "2014-09-07 08:15:33.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 152
Output for 5.4.31
object(DateTime)#2 (3) { ["date"]=> string(26) "2014-09-07 08:15:29.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 152
Output for 5.4.30
object(DateTime)#2 (3) { ["date"]=> string(26) "2014-09-07 08:15:25.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 152
Output for 5.4.28 - 5.4.29
object(DateTime)#2 (3) { ["date"]=> string(19) "2014-09-07 08:15:24" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 152
Output for 5.4.27
object(DateTime)#2 (3) { ["date"]=> string(19) "2014-09-07 08:15:30" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 152
Output for 5.4.6 - 5.4.26
object(DateTime)#2 (3) { ["date"]=> string(19) "2014-03-09 20:31:05" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 28
Output for 5.3.15 - 5.3.28, 5.4.0 - 5.4.5
object(DateTime)#2 (3) { ["date"]=> string(19) "2014-03-09 20:31:06" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 28
Output for 5.3.29
object(DateTime)#2 (3) { ["date"]=> string(19) "2014-09-07 08:15:25" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 152
Output for 5.3.0 - 5.3.14
object(DateTime)#2 (3) { ["date"]=> string(19) "2014-03-09 20:31:07" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } 28
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::diff() in /in/AR6oD on line 5
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/AR6oD on line 4
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/AR6oD on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/AR6oD on line 4