3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $now = new DateTime(); $punchIn = new DateTime(); // 10:55 am $punchIn->setTime(11,20); print_r((int)$now->diff($punchIn)->format('%i')); if ((int)$now->diff($punchIn)->format('%i') < 10) { print_r( 'punchIn'); }
Output for 5.6.13, 5.6.28, 7.0.3, 7.0.12 - 7.1.0
20
Output for 7.0.6
21
Output for 7.0.5
10
Output for 5.6.21, 7.0.4
31
Output for 5.5.29, 7.0.2
15
Output for 7.0.1
29
Output for 7.0.0
32
Output for 5.6.8, hhvm-3.12.0
44
Output for 5.6.14, hhvm-3.10.0
0punchIn
Output for 5.6.12, 5.6.20
11
Output for 5.6.19
16
Output for 5.6.18
43
Output for 5.6.17
6punchIn
Output for 5.6.16
45
Output for 5.6.15
54
Output for 5.6.11
3punchIn
Output for 5.6.10
13
Output for 5.6.9
23
Output for 5.5.35
41
Output for 5.5.34
58
Output for 5.5.33
40
Output for 5.5.28, 5.5.32
59
Output for 5.5.24, 5.5.26, 5.5.31
56
Output for 5.5.30
1punchIn
Output for 5.5.27
9punchIn
Output for 5.5.25
47
Output for 5.3.0 - 5.4.45
52
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::diff() in /in/L9CUM on line 7
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/L9CUM on line 2
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/L9CUM on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/L9CUM on line 7
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/L9CUM on line 7
Process exited with code 255.