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; }
Output for 7.0.0 - 7.0.25, 7.1.0 - 7.1.33, 7.2.5 - 7.2.25, 7.3.0 - 7.3.12, 7.4.0

preferences:
105.7 ms | 402 KiB | 78 Q