3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $datetime1 = new DateTime(); $datetime2 = new DateTime('2014-01-03 17:13:00'); $interval = $datetime1->diff($datetime2); $elapsed = $interval->format('%y years, %m months, %d days, %h hours, %i minutes, %S seconds'); echo $elapsed;
Output for 5.6.28, 7.0.14 - 7.1.0
0 years, 8 months, 11 days, 17 hours, 31 minutes, 01 seconds
Output for 7.0.6
2 years, 3 months, 30 days, 7 hours, 0 minutes, 39 seconds
Output for 7.0.5
2 years, 2 months, 29 days, 20 hours, 34 minutes, 55 seconds
Output for 7.0.4
2 years, 2 months, 6 days, 5 hours, 30 minutes, 17 seconds
Output for 7.0.3
2 years, 2 months, 14 days, 5 hours, 54 minutes, 30 seconds
Output for 7.0.2
2 years, 2 months, 17 days, 16 hours, 37 minutes, 39 seconds
Output for 7.0.1
2 years, 2 months, 19 days, 16 hours, 16 minutes, 31 seconds
Output for 7.0.0
2 years, 2 months, 22 days, 19 hours, 23 minutes, 55 seconds
Output for hhvm-3.12.0
2 years, 2 months, 7 days, 9 hours, 0 minutes, 05 seconds
Output for hhvm-3.10.0
2 years, 2 months, 25 days, 23 hours, 32 minutes, 19 seconds
Output for 5.6.21
2 years, 3 months, 29 days, 2 hours, 6 minutes, 27 seconds
Output for 5.6.20
2 years, 3 months, 5 days, 15 hours, 51 minutes, 06 seconds
Output for 5.6.19
2 years, 2 months, 3 days, 2 hours, 44 minutes, 47 seconds
Output for 5.6.18
2 years, 2 months, 10 days, 14 hours, 51 minutes, 55 seconds
Output for 5.6.17
2 years, 2 months, 15 days, 10 hours, 30 minutes, 31 seconds
Output for 5.6.16
2 years, 2 months, 23 days, 21 hours, 7 minutes, 10 seconds
Output for 5.6.15
2 years, 2 months, 24 days, 22 hours, 5 minutes, 04 seconds
Output for 5.6.14
2 years, 2 months, 29 days, 0 hours, 49 minutes, 02 seconds
Output for 5.6.13
2 years, 3 months, 11 days, 4 hours, 45 minutes, 46 seconds
Output for 5.6.12
2 years, 3 months, 15 days, 17 hours, 48 minutes, 47 seconds
Output for 5.6.11
2 years, 3 months, 19 days, 1 hours, 7 minutes, 49 seconds
Output for 5.6.10
2 years, 3 months, 21 days, 2 hours, 45 minutes, 35 seconds
Output for 5.6.9
2 years, 3 months, 23 days, 7 hours, 49 minutes, 10 seconds
Output for 5.6.8
2 years, 3 months, 25 days, 15 hours, 24 minutes, 17 seconds
Output for 5.6.7
2 years, 4 months, 21 days, 0 hours, 58 minutes, 34 seconds
Output for 5.5.35
2 years, 4 months, 18 days, 5 hours, 19 minutes, 00 seconds
Output for 5.5.34
2 years, 3 months, 6 days, 21 hours, 24 minutes, 38 seconds
Output for 5.5.33
2 years, 2 months, 4 days, 16 hours, 37 minutes, 01 seconds
Output for 5.5.32
2 years, 2 months, 12 days, 1 hours, 40 minutes, 40 seconds
Output for 5.5.31
2 years, 2 months, 16 days, 13 hours, 24 minutes, 53 seconds
Output for 5.5.30
2 years, 2 months, 28 days, 0 hours, 11 minutes, 34 seconds
Output for 5.5.29
2 years, 3 months, 12 days, 18 hours, 46 minutes, 29 seconds
Output for 5.5.28
2 years, 3 months, 16 days, 20 hours, 57 minutes, 54 seconds
Output for 5.5.27
2 years, 3 months, 17 days, 23 hours, 38 minutes, 30 seconds
Output for 5.5.26
2 years, 3 months, 22 days, 4 hours, 59 minutes, 47 seconds
Output for 5.5.25
2 years, 3 months, 24 days, 11 hours, 6 minutes, 28 seconds
Output for 5.5.24
2 years, 3 months, 26 days, 18 hours, 46 minutes, 56 seconds
Output for 5.4.45
1 years, 9 months, 11 days, 22 hours, 8 minutes, 43 seconds
Output for 5.4.42 - 5.4.44
1 years, 9 months, 11 days, 22 hours, 8 minutes, 44 seconds
Output for 5.4.40 - 5.4.41
1 years, 9 months, 11 days, 22 hours, 8 minutes, 45 seconds
Output for 5.4.38 - 5.4.39
1 years, 9 months, 11 days, 22 hours, 8 minutes, 46 seconds
Output for 5.4.35 - 5.4.37
1 years, 9 months, 11 days, 22 hours, 8 minutes, 47 seconds
Output for 5.4.32 - 5.4.34
1 years, 9 months, 11 days, 22 hours, 8 minutes, 48 seconds
Output for 5.4.30 - 5.4.31
1 years, 9 months, 11 days, 22 hours, 8 minutes, 49 seconds
Output for 5.4.27 - 5.4.29
1 years, 9 months, 11 days, 22 hours, 8 minutes, 50 seconds
Output for 5.4.25 - 5.4.26
1 years, 9 months, 11 days, 22 hours, 8 minutes, 51 seconds
Output for 5.4.22 - 5.4.24
1 years, 9 months, 11 days, 22 hours, 8 minutes, 52 seconds
Output for 5.4.18 - 5.4.21
1 years, 9 months, 11 days, 22 hours, 8 minutes, 53 seconds
Output for 5.4.15 - 5.4.17
1 years, 9 months, 11 days, 22 hours, 8 minutes, 54 seconds
Output for 5.4.13 - 5.4.14
1 years, 9 months, 11 days, 22 hours, 8 minutes, 55 seconds
Output for 5.4.10 - 5.4.12
1 years, 9 months, 11 days, 22 hours, 8 minutes, 56 seconds
Output for 5.4.8 - 5.4.9
1 years, 9 months, 11 days, 22 hours, 8 minutes, 57 seconds
Output for 5.4.6 - 5.4.7
1 years, 9 months, 11 days, 22 hours, 8 minutes, 58 seconds
Output for 5.4.3 - 5.4.5
1 years, 9 months, 11 days, 22 hours, 8 minutes, 59 seconds
Output for 5.4.1 - 5.4.2
1 years, 9 months, 11 days, 22 hours, 9 minutes, 00 seconds
Output for 5.3.28 - 5.4.0
1 years, 9 months, 11 days, 22 hours, 9 minutes, 01 seconds
Output for 5.3.26 - 5.3.27
1 years, 9 months, 11 days, 22 hours, 9 minutes, 02 seconds
Output for 5.3.23 - 5.3.25
1 years, 9 months, 11 days, 22 hours, 9 minutes, 03 seconds
Output for 5.3.21 - 5.3.22
1 years, 9 months, 11 days, 22 hours, 9 minutes, 04 seconds
Output for 5.3.18 - 5.3.20
1 years, 9 months, 11 days, 22 hours, 9 minutes, 05 seconds
Output for 5.3.15 - 5.3.17
1 years, 9 months, 11 days, 22 hours, 9 minutes, 06 seconds
Output for 5.3.13 - 5.3.14
1 years, 9 months, 11 days, 22 hours, 9 minutes, 07 seconds
Output for 5.3.10 - 5.3.12
1 years, 9 months, 11 days, 22 hours, 9 minutes, 08 seconds
Output for 5.3.8 - 5.3.9
1 years, 9 months, 11 days, 22 hours, 9 minutes, 09 seconds
Output for 5.3.6 - 5.3.7
1 years, 9 months, 11 days, 22 hours, 9 minutes, 10 seconds
Output for 5.3.3 - 5.3.5
1 years, 9 months, 11 days, 22 hours, 9 minutes, 11 seconds
Output for 5.3.1 - 5.3.2
1 years, 9 months, 11 days, 22 hours, 9 minutes, 12 seconds
Output for 5.3.0
1 years, 9 months, 11 days, 22 hours, 9 minutes, 13 seconds
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::diff() in /in/X19Hr on line 4
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/X19Hr 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/X19Hr 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/X19Hr on line 2