3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $datetime1 = new DateTime(); $datetime2 = new DateTime('2013-01-10 16:26:00'); $interval = $datetime1->diff($datetime2); echo $interval->format('%h hours %i minutes');
Output for 5.3.0 - 5.3.27, 5.4.0 - 5.4.19, 5.6.28, 7.0.14 - 7.1.0
6 hours 1 minutes
Output for 7.0.6
14 hours 55 minutes
Output for 7.0.5
3 hours 55 minutes
Output for 7.0.4
14 hours 6 minutes
Output for 7.0.3
14 hours 35 minutes
Output for 7.0.2
20 hours 8 minutes
Output for 7.0.1
1 hours 27 minutes
Output for 7.0.0
3 hours 9 minutes
Output for hhvm-3.12.0
23 hours 28 minutes
Output for hhvm-3.10.0
12 hours 45 minutes
Output for 5.6.21
10 hours 13 minutes
Output for 5.6.20
0 hours 22 minutes
Output for 5.6.19
16 hours 16 minutes
Output for 5.6.16, 5.6.18
4 hours 54 minutes
Output for 5.6.17
18 hours 55 minutes
Output for 5.6.15
5 hours 48 minutes
Output for 5.6.14
8 hours 14 minutes
Output for 5.6.13
12 hours 18 minutes
Output for 5.6.12
1 hours 51 minutes
Output for 5.6.11
8 hours 49 minutes
Output for 5.6.10
10 hours 41 minutes
Output for 5.6.9
15 hours 39 minutes
Output for 5.6.8
23 hours 36 minutes
Output for 5.6.7
16 hours 26 minutes
Output for 5.5.35
13 hours 50 minutes
Output for 5.5.34
5 hours 9 minutes
Output for 5.5.33
1 hours 1 minutes
Output for 5.5.32
7 hours 4 minutes
Output for 5.5.31
21 hours 43 minutes
Output for 5.5.30
7 hours 48 minutes
Output for 5.5.29
2 hours 23 minutes
Output for 5.5.28
4 hours 56 minutes
Output for 5.5.27
7 hours 21 minutes
Output for 5.5.26
13 hours 7 minutes
Output for 5.5.25
19 hours 10 minutes
Output for 5.5.24
2 hours 6 minutes
Output for 5.4.42 - 5.4.45
19 hours 14 minutes
Output for 5.4.39 - 5.4.41
1 hours 30 minutes
Output for 5.4.38
9 hours 24 minutes
Output for 5.4.34 - 5.4.37
22 hours 41 minutes
Output for 5.4.32
8 hours 28 minutes
Output for 5.3.28 - 5.3.29, 5.4.20 - 5.4.31
8 hours 27 minutes
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::diff() in /in/UqJHE on line 4
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/UqJHE 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/UqJHE 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/UqJHE on line 2