- 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
<?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;
}