3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $expires_at = DateTime::createFromFormat("Y-m-d H:i:s", "2014-08-14 13:22:22"); $now = new DateTime(); $interval = $now->diff($expires_at); echo ( $interval->i );
based on XQS6o
Output for 5.5.29, 5.6.28, 7.0.4, 7.0.14 - 7.1.0
7
Output for 7.0.6
45
Output for 7.0.5
33
Output for 5.5.31, 7.0.3
46
Output for 7.0.2
39
Output for 7.0.1
22
Output for 7.0.0
55
Output for 5.6.21
4
Output for 5.6.20
30
Output for 5.6.19
15
Output for 5.5.25, 5.6.18
19
Output for 5.6.13, 5.6.17
0
Output for 5.6.16
42
Output for 5.6.12, 5.6.15
47
Output for 5.6.14
6
Output for 5.6.11
50
Output for 5.6.10
34
Output for 5.6.9
32
Output for 5.6.8
41
Output for 5.5.35
52
Output for 5.5.34
51
Output for 5.5.33
12
Output for 5.3.0 - 5.4.45, 5.5.28, 5.5.32
54
Output for 5.5.30
43
Output for 5.5.27
21
Output for 5.5.26
1
Output for 5.5.24
40
Output for 5.2.10 - 5.2.17
Fatal error: Call to undefined method DateTime::createFromFormat() in /in/2R7Vk on line 2
Process exited with code 255.
Output for 5.2.0 - 5.2.9
Fatal error: Call to undefined method DateTime::createfromformat() in /in/2R7Vk on line 2
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/2R7Vk on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Undefined class name 'datetime' in /in/2R7Vk on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Undefined class name 'datetime' in /in/2R7Vk on line 2