3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $today = new DateTime(); $birthdate = new DateTime("1990-01-08"); $interval = $today->diff($birthdate); echo $interval->format('%y years %m months %d days old');
Output for 5.6.28, 7.0.14 - 7.1.0
23 years 3 months 24 days old
Output for 7.0.6
26 years 3 months 26 days old
Output for 7.0.5
26 years 2 months 26 days old
Output for 7.0.4
26 years 2 months 2 days old
Output for 7.0.3
26 years 2 months 10 days old
Output for 7.0.2
26 years 2 months 15 days old
Output for 7.0.1
26 years 2 months 16 days old
Output for 7.0.0
26 years 2 months 19 days old
Output for 5.6.21
26 years 3 months 25 days old
Output for 5.6.20
26 years 3 months 2 days old
Output for 5.6.19
26 years 2 months 0 days old
Output for 5.6.18
26 years 2 months 7 days old
Output for 5.6.17
26 years 2 months 11 days old
Output for 5.6.16
26 years 2 months 20 days old
Output for 5.6.15
26 years 2 months 21 days old
Output for 5.6.14
26 years 2 months 25 days old
Output for 5.6.13
26 years 3 months 7 days old
Output for 5.6.12
26 years 3 months 12 days old
Output for 5.6.11
26 years 3 months 16 days old
Output for 5.6.10
26 years 3 months 17 days old
Output for 5.6.9
26 years 3 months 19 days old
Output for 5.6.8
26 years 3 months 22 days old
Output for 5.5.35
26 years 4 months 14 days old
Output for 5.5.34
26 years 3 months 3 days old
Output for 5.5.33
26 years 2 months 1 days old
Output for 5.5.32
26 years 2 months 9 days old
Output for 5.5.31
26 years 2 months 13 days old
Output for 5.5.30
26 years 2 months 24 days old
Output for 5.5.29
26 years 3 months 9 days old
Output for 5.5.28
26 years 3 months 13 days old
Output for 5.5.27
26 years 3 months 14 days old
Output for 5.5.26
26 years 3 months 18 days old
Output for 5.5.25
26 years 3 months 21 days old
Output for 5.5.24
26 years 4 months 16 days old
Output for 5.3.0 - 5.4.45
25 years 10 months 8 days old
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::diff() in /in/NPalC on line 4
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/NPalC 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/NPalC 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/NPalC on line 2