3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $datetime1 = new DateTime(); $datetime2 = new DateTime('2014-05-05 19:13:00'); $interval = $datetime1->diff($datetime2); echo $interval->format('%h hours %i minutes');
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.26, 5.6.28, 7.0.14 - 7.1.0
10 hours 32 minutes
Output for 7.0.6
7 hours 7 minutes
Output for 7.0.5
20 hours 24 minutes
Output for 7.0.4
5 hours 54 minutes
Output for 7.0.3
6 hours 4 minutes
Output for 7.0.2
16 hours 39 minutes
Output for 7.0.1
16 hours 52 minutes
Output for 7.0.0
19 hours 21 minutes
Output for 5.6.21
2 hours 10 minutes
Output for 5.6.20
15 hours 37 minutes
Output for 5.6.19
4 hours 7 minutes
Output for 5.6.18
16 hours 4 minutes
Output for 5.6.17
10 hours 33 minutes
Output for 5.6.16
21 hours 6 minutes
Output for 5.6.15
22 hours 0 minutes
Output for 5.6.14
0 hours 38 minutes
Output for 5.6.13
4 hours 26 minutes
Output for 5.6.12
17 hours 35 minutes
Output for 5.6.11
0 hours 51 minutes
Output for 5.6.10
2 hours 31 minutes
Output for 5.6.9
7 hours 40 minutes
Output for 5.6.8
15 hours 16 minutes
Output for 5.6.7
1 hours 59 minutes
Output for 5.5.35
5 hours 32 minutes
Output for 5.5.34
21 hours 33 minutes
Output for 5.5.33
16 hours 46 minutes
Output for 5.5.32
22 hours 27 minutes
Output for 5.5.31
13 hours 26 minutes
Output for 5.5.30
0 hours 1 minutes
Output for 5.5.29
18 hours 33 minutes
Output for 5.5.28
20 hours 51 minutes
Output for 5.5.27
23 hours 22 minutes
Output for 5.5.26
4 hours 49 minutes
Output for 5.5.25
10 hours 57 minutes
Output for 5.5.24
18 hours 27 minutes
Output for 5.4.44 - 5.4.45
2 hours 7 minutes
Output for 5.4.41 - 5.4.43
16 hours 9 minutes
Output for 5.4.39 - 5.4.40
10 hours 55 minutes
Output for 5.4.38
-1 hours 13 minutes
Output for 5.4.34 - 5.4.37
2 hours 11 minutes
Output for 5.3.29, 5.4.27 - 5.4.32
17 hours 25 minutes
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::diff() in /in/VUdpF on line 4
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/VUdpF 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/VUdpF 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/VUdpF on line 2