3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $datetime1 = new DateTime(); $datetime2 = new DateTime('2013-05-04 20:16:15'); $interval = $datetime1->diff($datetime2); $elapsed = $interval->format('%y years, %m months, %a days, %h hours, %i minutes, %S seconds'); echo $elapsed;
Output for 5.6.28, 7.0.12 - 7.1.0
0 years, 0 months, 3 days, 5 hours, 48 minutes, 39 seconds
Output for 7.0.6
2 years, 11 months, 1094 days, 4 hours, 49 minutes, 09 seconds
Output for 7.0.5
2 years, 10 months, 1063 days, 18 hours, 9 minutes, 44 seconds
Output for 7.0.4
2 years, 10 months, 1040 days, 3 hours, 10 minutes, 09 seconds
Output for 7.0.3
2 years, 10 months, 1048 days, 3 hours, 34 minutes, 46 seconds
Output for 7.0.2
2 years, 10 months, 1051 days, 14 hours, 16 minutes, 30 seconds
Output for 7.0.1
2 years, 10 months, 1053 days, 13 hours, 57 minutes, 59 seconds
Output for 7.0.0
2 years, 10 months, 1056 days, 16 hours, 58 minutes, 09 seconds
Output for hhvm-3.12.0
2 years, 10 months, 1041 days, 7 hours, 1 minutes, 49 seconds
Output for hhvm-3.10.0
2 years, 10 months, 1059 days, 21 hours, 27 minutes, 50 seconds
Output for 5.6.21
2 years, 11 months, 1092 days, 23 hours, 53 minutes, 59 seconds
Output for 5.6.20
2 years, 11 months, 1070 days, 13 hours, 24 minutes, 41 seconds
Output for 5.6.19
2 years, 10 months, 1037 days, 0 hours, 50 minutes, 38 seconds
Output for 5.6.18
2 years, 10 months, 1044 days, 13 hours, 5 minutes, 50 seconds
Output for 5.6.17
2 years, 10 months, 1049 days, 8 hours, 9 minutes, 57 seconds
Output for 5.6.16
2 years, 10 months, 1057 days, 18 hours, 42 minutes, 58 seconds
Output for 5.6.15
2 years, 10 months, 1058 days, 19 hours, 41 minutes, 59 seconds
Output for 5.6.14
2 years, 10 months, 1062 days, 22 hours, 24 minutes, 48 seconds
Output for 5.6.13
2 years, 11 months, 1076 days, 2 hours, 16 minutes, 07 seconds
Output for 5.6.12
2 years, 11 months, 1080 days, 15 hours, 21 minutes, 00 seconds
Output for 5.6.11
2 years, 11 months, 1083 days, 22 hours, 38 minutes, 31 seconds
Output for 5.6.10
2 years, 11 months, 1086 days, 0 hours, 17 minutes, 27 seconds
Output for 5.6.9
2 years, 11 months, 1088 days, 5 hours, 23 minutes, 01 seconds
Output for 5.6.8
2 years, 11 months, 1090 days, 12 hours, 57 minutes, 08 seconds
Output for 5.6.7
3 years, 0 months, 1115 days, 22 hours, 56 minutes, 09 seconds
Output for 5.5.35
3 years, 0 months, 1113 days, 2 hours, 58 minutes, 51 seconds
Output for 5.5.34
2 years, 11 months, 1071 days, 19 hours, 16 minutes, 32 seconds
Output for 5.5.33
2 years, 10 months, 1038 days, 14 hours, 24 minutes, 25 seconds
Output for 5.5.32
2 years, 10 months, 1045 days, -1 hours, 22 minutes, 57 seconds
Output for 5.5.31
2 years, 10 months, 1050 days, 11 hours, 3 minutes, 52 seconds
Output for 5.5.30
2 years, 10 months, 1061 days, 21 hours, 46 minutes, 43 seconds
Output for 5.5.29
2 years, 11 months, 1077 days, 16 hours, 19 minutes, 58 seconds
Output for 5.5.28
2 years, 11 months, 1081 days, 18 hours, 31 minutes, 40 seconds
Output for 5.5.27
2 years, 11 months, 1082 days, 21 hours, 9 minutes, 51 seconds
Output for 5.5.26
2 years, 11 months, 1087 days, 2 hours, 32 minutes, 25 seconds
Output for 5.5.25
2 years, 11 months, 1089 days, 8 hours, 39 minutes, 14 seconds
Output for 5.5.24
2 years, 11 months, 1091 days, 16 hours, 16 minutes, 44 seconds
Output for 5.4.44 - 5.4.45
2 years, 9 months, 1022 days, 4 hours, 52 minutes, 56 seconds
Output for 5.4.42 - 5.4.43
2 years, 9 months, 1022 days, 4 hours, 52 minutes, 57 seconds
Output for 5.4.41
2 years, 9 months, 1022 days, 4 hours, 52 minutes, 58 seconds
Output for 5.4.38 - 5.4.40
2 years, 9 months, 1022 days, 4 hours, 52 minutes, 59 seconds
Output for 5.4.36 - 5.4.37
2 years, 9 months, 1022 days, 4 hours, 53 minutes, 00 seconds
Output for 5.4.34 - 5.4.35
2 years, 9 months, 1022 days, 4 hours, 53 minutes, 01 seconds
Output for 5.3.29, 5.4.31 - 5.4.32
2 years, 9 months, 1022 days, 4 hours, 53 minutes, 02 seconds
Output for 5.4.27 - 5.4.30
2 years, 9 months, 1022 days, 4 hours, 53 minutes, 03 seconds
Output for 5.4.24 - 5.4.26
2 years, 9 months, 1022 days, 4 hours, 53 minutes, 04 seconds
Output for 5.3.28, 5.4.21 - 5.4.23
2 years, 9 months, 1022 days, 4 hours, 53 minutes, 05 seconds
Output for 5.4.18 - 5.4.20
2 years, 9 months, 1022 days, 4 hours, 53 minutes, 06 seconds
Output for 5.3.25 - 5.3.27, 5.4.15 - 5.4.17
2 years, 9 months, 1022 days, 4 hours, 53 minutes, 07 seconds
Output for 5.3.21 - 5.3.24, 5.4.12 - 5.4.14
2 years, 9 months, 1022 days, 4 hours, 53 minutes, 08 seconds
Output for 5.3.17 - 5.3.20, 5.4.8 - 5.4.11
2 years, 9 months, 1022 days, 4 hours, 53 minutes, 09 seconds
Output for 5.3.14 - 5.3.16, 5.4.4 - 5.4.7
2 years, 9 months, 1022 days, 4 hours, 53 minutes, 10 seconds
Output for 5.3.10 - 5.3.13, 5.4.0 - 5.4.3
2 years, 9 months, 1022 days, 4 hours, 53 minutes, 11 seconds
Output for 5.3.5 - 5.3.9
2 years, 9 months, 1022 days, 4 hours, 53 minutes, 12 seconds
Output for 5.3.1 - 5.3.4
2 years, 9 months, 1022 days, 4 hours, 53 minutes, 13 seconds
Output for 5.3.0
2 years, 9 months, 1022 days, 4 hours, 53 minutes, 14 seconds
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::diff() in /in/LBQ67 on line 4
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/LBQ67 on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/LBQ67 on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/LBQ67 on line 2