3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $from = new DateTime('24 June 1940'); $till = new DateTime('now'); list($fromYear, $fromDay) = explode(' ', $from->format('Y z')); list($tillYear, $tillDay) = explode(' ', $till->format('Y z')); $age = $tillYear - $fromYear - ($tillDay < $fromDay); print $age;
based on 9Lk0E
Output for 5.6.28, 7.0.14 - 7.1.0
74
Output for 5.2.0 - 5.6.21, 7.0.0 - 7.0.6
75
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/GuCvW 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/GuCvW 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/GuCvW on line 3