3v4l.org

run code in 300+ PHP versions simultaneously
<?php $year = 1999; $month = 2; $day = 6; $birthday = $month.$day.$year; // validate birthday function validateAge($birthday, $age = 25) { // $birthday can be UNIX_TIMESTAMP or just a string-date. if(is_string($birthday)) { $birthday = strtotime($birthday); echo "OLDER THAN 25!!!"; } // check // 31536000 is the number of seconds in a 365 days year. if(time() - $birthday < $age * 31536000) { echo "NOT OLDER THAN 25!!!"; return false; } return true; } validateAge($birthday,25);
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.26, 7.3.0 - 7.3.13, 7.4.0 - 7.4.1
OLDER THAN 25!!!

preferences:
143.65 ms | 402 KiB | 157 Q