3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $date = new DateTime(); $date->setTimestamp(1397127298); $interval = $date->diff(new DateTime('now')); print($interval->format('%y years, %m months, %d days, %h hours and %i minutes ago')); ?>
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.27, 5.6.28, 7.0.14 - 7.1.0
0 years, 0 months, 0 days, 0 hours and 24 minutes ago
Output for 7.0.6
2 years, 0 months, 22 days, 21 hours and 3 minutes ago
Output for 7.0.5
1 years, 11 months, 23 days, 9 hours and 53 minutes ago
Output for 7.0.4
1 years, 10 months, 28 days, 20 hours and 28 minutes ago
Output for 7.0.3
1 years, 11 months, 7 days, 21 hours and 6 minutes ago
Output for 7.0.2
1 years, 11 months, 12 days, 2 hours and 59 minutes ago
Output for 7.0.1
1 years, 11 months, 13 days, 7 hours and 43 minutes ago
Output for 7.0.0
1 years, 11 months, 16 days, 9 hours and 15 minutes ago
Output for 5.6.21
2 years, 0 months, 21 days, 16 hours and 24 minutes ago
Output for 5.6.20
1 years, 11 months, 30 days, 8 hours and 51 minutes ago
Output for 5.6.19
1 years, 10 months, 26 days, 4 hours and 35 minutes ago
Output for 5.6.18
1 years, 11 months, 4 days, 12 hours and 36 minutes ago
Output for 5.6.17
1 years, 11 months, 9 days, 1 hours and 20 minutes ago
Output for 5.6.16
1 years, 11 months, 17 days, 11 hours and 1 minutes ago
Output for 5.6.15
1 years, 11 months, 18 days, 12 hours and 6 minutes ago
Output for 5.6.14
1 years, 11 months, 22 days, 14 hours and 27 minutes ago
Output for 5.6.13
2 years, 0 months, 4 days, 18 hours and 21 minutes ago
Output for 5.6.12
2 years, 0 months, 9 days, 8 hours and 6 minutes ago
Output for 5.6.11
2 years, 0 months, 12 days, 15 hours and 10 minutes ago
Output for 5.6.10
2 years, 0 months, 14 days, 16 hours and 54 minutes ago
Output for 5.6.9
2 years, 0 months, 16 days, 21 hours and 52 minutes ago
Output for 5.6.8
2 years, 0 months, 19 days, 5 hours and 59 minutes ago
Output for 5.5.35
2 years, 1 months, 13 days, 1 hours and 8 minutes ago
Output for 5.5.34
2 years, 0 months, 0 days, 11 hours and 12 minutes ago
Output for 5.5.33
1 years, 10 months, 27 days, 7 hours and 32 minutes ago
Output for 5.5.32
1 years, 11 months, 6 days, 14 hours and 14 minutes ago
Output for 5.5.31
1 years, 11 months, 10 days, 4 hours and 6 minutes ago
Output for 5.5.30
1 years, 11 months, 21 days, 14 hours and 2 minutes ago
Output for 5.5.29
2 years, 0 months, 6 days, 8 hours and 27 minutes ago
Output for 5.5.28
2 years, 0 months, 10 days, 11 hours and 13 minutes ago
Output for 5.5.27
2 years, 0 months, 11 days, 13 hours and 41 minutes ago
Output for 5.5.26
2 years, 0 months, 15 days, 19 hours and 21 minutes ago
Output for 5.5.25
2 years, 0 months, 18 days, 1 hours and 39 minutes ago
Output for 5.5.24
2 years, 1 months, 14 days, 1 hours and 50 minutes ago
Output for 5.4.39 - 5.4.45
1 years, 5 months, 10 days, 10 hours and 8 minutes ago
Output for 5.4.34 - 5.4.38
0 years, 11 months, 3 days, 17 hours and 40 minutes ago
Output for 5.3.29, 5.4.28 - 5.4.32
0 years, 4 months, 29 days, 10 hours and 48 minutes ago
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::setTimestamp() in /in/vAXtY on line 4
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/vAXtY on line 3
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/vAXtY on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/vAXtY on line 3