3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $datetime1 = new DateTime(); $datetime2 = new DateTime('2013-09-12 12:00: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, 0 months, 0 days, 05 hours, 5 minutes, 38 seconds
Output for 7.0.6
2 years, 7 months, 21 days, 04 hours, 40 minutes, 21 seconds
Output for 7.0.5
2 years, 6 months, 20 days, 17 hours, 11 minutes, 4 seconds
Output for 7.0.4
2 years, 5 months, 28 days, 04 hours, 47 minutes, 20 seconds
Output for 7.0.3
2 years, 6 months, 6 days, 05 hours, 31 minutes, 41 seconds
Output for 7.0.2
2 years, 6 months, 10 days, 11 hours, 38 minutes, 14 seconds
Output for 7.0.1
2 years, 6 months, 11 days, 15 hours, 49 minutes, 28 seconds
Output for 7.0.0
2 years, 6 months, 14 days, 17 hours, 46 minutes, 28 seconds
Output for 5.6.21
2 years, 7 months, 19 days, 23 hours, 50 minutes, 43 seconds
Output for 5.6.20
2 years, 6 months, 27 days, 16 hours, 9 minutes, 13 seconds
Output for 5.6.19
2 years, 5 months, 25 days, 12 hours, 35 minutes, 5 seconds
Output for 5.6.18
2 years, 6 months, 2 days, 21 hours, 27 minutes, 8 seconds
Output for 5.6.17
2 years, 6 months, 7 days, 09 hours, 20 minutes, 9 seconds
Output for 5.6.16
2 years, 6 months, 15 days, 18 hours, 34 minutes, 7 seconds
Output for 5.6.15
2 years, 6 months, 16 days, 19 hours, 25 minutes, 7 seconds
Output for 5.6.14
2 years, 6 months, 19 days, 21 hours, 22 minutes, 12 seconds
Output for 5.6.13
2 years, 7 months, 3 days, 01 hours, 38 minutes, 47 seconds
Output for 5.6.12
2 years, 7 months, 7 days, 16 hours, 4 minutes, 55 seconds
Output for 5.6.11
2 years, 7 months, 10 days, 22 hours, 35 minutes, 44 seconds
Output for 5.6.10
2 years, 7 months, 13 days, 00 hours, 30 minutes, 54 seconds
Output for 5.6.9
2 years, 7 months, 15 days, 05 hours, 38 minutes, 45 seconds
Output for 5.6.8
2 years, 7 months, 17 days, 14 hours, 23 minutes, 15 seconds
Output for 5.5.35
2 years, 8 months, 10 days, 05 hours, 32 minutes, 43 seconds
Output for 5.5.34
2 years, 6 months, 28 days, 18 hours, 23 minutes, 9 seconds
Output for 5.5.33
2 years, 5 months, 26 days, 15 hours, 35 minutes, 32 seconds
Output for 5.5.32
2 years, 6 months, 5 days, 01 hours, 9 minutes, 51 seconds
Output for 5.5.31
2 years, 6 months, 8 days, 12 hours, 11 minutes, 26 seconds
Output for 5.5.30
2 years, 6 months, 18 days, 21 hours, 19 minutes, 1 seconds
Output for 5.5.29
2 years, 7 months, 4 days, 16 hours, 3 minutes, 1 seconds
Output for 5.5.28
2 years, 7 months, 8 days, 19 hours, 15 minutes, 58 seconds
Output for 5.5.27
2 years, 7 months, 9 days, 21 hours, 11 minutes, 7 seconds
Output for 5.5.26
2 years, 7 months, 14 days, 03 hours, 11 minutes, 59 seconds
Output for 5.5.25
2 years, 7 months, 16 days, 10 hours, 0 minutes, 20 seconds
Output for 5.5.24
2 years, 8 months, 11 days, 16 hours, 45 minutes, 59 seconds
Output for 5.4.45
2 years, 2 months, 7 days, 10 hours, 0 minutes, 30 seconds
Output for 5.4.44
2 years, 2 months, 7 days, 10 hours, 0 minutes, 31 seconds
Output for 5.4.42 - 5.4.43
2 years, 2 months, 7 days, 10 hours, 0 minutes, 33 seconds
Output for 5.4.40 - 5.4.41
2 years, 2 months, 7 days, 10 hours, 0 minutes, 34 seconds
Output for 5.4.38 - 5.4.39
2 years, 2 months, 7 days, 10 hours, 0 minutes, 35 seconds
Output for 5.4.36 - 5.4.37
2 years, 2 months, 7 days, 10 hours, 0 minutes, 36 seconds
Output for 5.4.34 - 5.4.35
2 years, 2 months, 7 days, 10 hours, 0 minutes, 37 seconds
Output for 5.3.29, 5.4.31 - 5.4.32
2 years, 2 months, 7 days, 10 hours, 0 minutes, 38 seconds
Output for 5.4.28 - 5.4.30
2 years, 2 months, 7 days, 10 hours, 0 minutes, 39 seconds
Output for 5.4.25 - 5.4.27
2 years, 2 months, 7 days, 10 hours, 0 minutes, 40 seconds
Output for 5.3.28, 5.4.23 - 5.4.24
2 years, 2 months, 7 days, 10 hours, 0 minutes, 41 seconds
Output for 5.4.19 - 5.4.22
2 years, 2 months, 7 days, 10 hours, 0 minutes, 42 seconds
Output for 5.3.26 - 5.3.27, 5.4.16 - 5.4.18
2 years, 2 months, 7 days, 10 hours, 0 minutes, 43 seconds
Output for 5.3.23 - 5.3.25, 5.4.13 - 5.4.15
2 years, 2 months, 7 days, 10 hours, 0 minutes, 44 seconds
Output for 5.3.20 - 5.3.22, 5.4.9 - 5.4.12
2 years, 2 months, 7 days, 10 hours, 0 minutes, 45 seconds
Output for 5.3.17 - 5.3.19, 5.4.6 - 5.4.8
2 years, 2 months, 7 days, 10 hours, 0 minutes, 46 seconds
Output for 5.3.13 - 5.3.16, 5.4.3 - 5.4.5
2 years, 2 months, 7 days, 10 hours, 0 minutes, 47 seconds
Output for 5.3.10 - 5.3.12, 5.4.0 - 5.4.2
2 years, 2 months, 7 days, 10 hours, 0 minutes, 48 seconds
Output for 5.3.5 - 5.3.9
2 years, 2 months, 7 days, 10 hours, 0 minutes, 49 seconds
Output for 5.3.2 - 5.3.4
2 years, 2 months, 7 days, 10 hours, 0 minutes, 50 seconds
Output for 5.3.0 - 5.3.1
2 years, 2 months, 7 days, 10 hours, 0 minutes, 51 seconds
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::diff() in /in/DI7BL on line 4
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/DI7BL 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/DI7BL 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/DI7BL on line 2