3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $datetime1 = new DateTime(); $datetime2 = new DateTime('2013-05-07 19:05: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, 0 days, 7 hours, 0 minutes, 58 seconds
Output for 7.0.6
2 years, 11 months, 1091 days, 6 hours, 2 minutes, 04 seconds
Output for 7.0.5
2 years, 10 months, 1060 days, 19 hours, 22 minutes, 32 seconds
Output for 7.0.4
2 years, 10 months, 1037 days, 4 hours, 23 minutes, 01 seconds
Output for 7.0.3
2 years, 10 months, 1045 days, 4 hours, 47 minutes, 45 seconds
Output for 7.0.2
2 years, 10 months, 1048 days, 15 hours, 29 minutes, 27 seconds
Output for 7.0.1
2 years, 10 months, 1050 days, 15 hours, 11 minutes, 01 seconds
Output for 7.0.0
2 years, 10 months, 1053 days, 18 hours, 10 minutes, 53 seconds
Output for 5.6.21
2 years, 11 months, 1090 days, 1 hours, 6 minutes, 50 seconds
Output for 5.6.20
2 years, 11 months, 1067 days, 14 hours, 37 minutes, 26 seconds
Output for 5.6.19
2 years, 9 months, 1034 days, 2 hours, 4 minutes, 49 seconds
Output for 5.6.18
2 years, 10 months, 1041 days, 14 hours, 18 minutes, 52 seconds
Output for 5.6.17
2 years, 10 months, 1046 days, 9 hours, 22 minutes, 53 seconds
Output for 5.6.16
2 years, 10 months, 1054 days, 19 hours, 55 minutes, 50 seconds
Output for 5.6.15
2 years, 10 months, 1055 days, 20 hours, 54 minutes, 48 seconds
Output for 5.6.14
2 years, 10 months, 1059 days, 23 hours, 37 minutes, 45 seconds
Output for 5.6.13
2 years, 11 months, 1073 days, 3 hours, 28 minutes, 26 seconds
Output for 5.6.12
2 years, 11 months, 1077 days, 16 hours, 33 minutes, 16 seconds
Output for 5.6.11
2 years, 11 months, 1080 days, 23 hours, 50 minutes, 49 seconds
Output for 5.6.10
2 years, 11 months, 1083 days, 1 hours, 29 minutes, 44 seconds
Output for 5.6.9
2 years, 11 months, 1085 days, 6 hours, 35 minutes, 23 seconds
Output for 5.6.8
2 years, 11 months, 1087 days, 14 hours, 9 minutes, 30 seconds
Output for 5.6.7
3 years, 0 months, 1113 days, 0 hours, 11 minutes, 28 seconds
Output for 5.5.35
3 years, 0 months, 1110 days, 4 hours, 11 minutes, 50 seconds
Output for 5.5.34
2 years, 11 months, 1068 days, 20 hours, 29 minutes, 30 seconds
Output for 5.5.33
2 years, 10 months, 1035 days, 15 hours, 37 minutes, 25 seconds
Output for 5.5.32
2 years, 10 months, 1043 days, 0 hours, 35 minutes, 58 seconds
Output for 5.5.31
2 years, 10 months, 1047 days, 12 hours, 16 minutes, 48 seconds
Output for 5.5.30
2 years, 10 months, 1058 days, 22 hours, 59 minutes, 36 seconds
Output for 5.5.29
2 years, 11 months, 1074 days, 17 hours, 32 minutes, 19 seconds
Output for 5.5.28
2 years, 11 months, 1078 days, 19 hours, 43 minutes, 59 seconds
Output for 5.5.27
2 years, 11 months, 1079 days, 22 hours, 22 minutes, 07 seconds
Output for 5.5.26
2 years, 11 months, 1084 days, 3 hours, 44 minutes, 46 seconds
Output for 5.5.25
2 years, 11 months, 1086 days, 9 hours, 51 minutes, 35 seconds
Output for 5.5.24
2 years, 11 months, 1088 days, 17 hours, 28 minutes, 57 seconds
Output for 5.4.45
2 years, 9 months, 1018 days, 2 hours, 37 minutes, 12 seconds
Output for 5.4.44
2 years, 9 months, 1018 days, 2 hours, 37 minutes, 13 seconds
Output for 5.4.42 - 5.4.43
2 years, 9 months, 1018 days, 2 hours, 37 minutes, 14 seconds
Output for 5.4.40 - 5.4.41
2 years, 9 months, 1018 days, 2 hours, 37 minutes, 15 seconds
Output for 5.4.38 - 5.4.39
2 years, 9 months, 1018 days, 2 hours, 37 minutes, 16 seconds
Output for 5.4.35 - 5.4.37
2 years, 9 months, 1018 days, 2 hours, 37 minutes, 17 seconds
Output for 5.4.34
2 years, 9 months, 1018 days, 2 hours, 37 minutes, 18 seconds
Output for 5.3.29, 5.4.29 - 5.4.32
2 years, 9 months, 1018 days, 2 hours, 37 minutes, 19 seconds
Output for 5.4.26 - 5.4.28
2 years, 9 months, 1018 days, 2 hours, 37 minutes, 20 seconds
Output for 5.3.28, 5.4.23 - 5.4.25
2 years, 9 months, 1018 days, 2 hours, 37 minutes, 21 seconds
Output for 5.4.19 - 5.4.22
2 years, 9 months, 1018 days, 2 hours, 37 minutes, 22 seconds
Output for 5.3.25 - 5.3.27, 5.4.16 - 5.4.18
2 years, 9 months, 1018 days, 2 hours, 37 minutes, 23 seconds
Output for 5.3.21 - 5.3.24, 5.4.12 - 5.4.15
2 years, 9 months, 1018 days, 2 hours, 37 minutes, 24 seconds
Output for 5.3.18 - 5.3.20, 5.4.8 - 5.4.11
2 years, 9 months, 1018 days, 2 hours, 37 minutes, 25 seconds
Output for 5.3.14 - 5.3.17, 5.4.5 - 5.4.7
2 years, 9 months, 1018 days, 2 hours, 37 minutes, 26 seconds
Output for 5.3.11 - 5.3.13, 5.4.0 - 5.4.4
2 years, 9 months, 1018 days, 2 hours, 37 minutes, 27 seconds
Output for 5.3.5 - 5.3.10
2 years, 9 months, 1018 days, 2 hours, 37 minutes, 28 seconds
Output for 5.3.2 - 5.3.4
2 years, 9 months, 1018 days, 2 hours, 37 minutes, 29 seconds
Output for 5.3.0 - 5.3.1
2 years, 9 months, 1018 days, 2 hours, 37 minutes, 30 seconds
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::diff() in /in/P6PUj on line 4
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/P6PUj 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/P6PUj 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/P6PUj on line 2