Categories
Uncategorized

php :: check if person is adult


function isAdult($birthyear, $birthmonth, $birthday)
{
$birthdayTime = mktime(0, 0, 0, $birthmonth, $birthday, $birthyear);
$now = time();

$ageSeconds = $now - $birthdayTime;
$years = $ageSeconds / 3600 / 24 / 365.25;

return $years >=18;
}

if(isAdult($year, $month, $day))
{
echo "your adult! feel free to buy guns.";
}
else
{
echo "goto kindergarden!";
}