$age=date("Y",$now)-date("Y",$birthdate);
if (date("m",$now)<date("m",$birthdate)) {
$age--;
} elseif ((date("m",$now)==date("m",$birthdate))) {
if (date("d",$now)<date("d",$birthdate)) {
$age--;
}
}
I didn't want to do $now-$birthdate and divide by (606024*365) because of leap years. so what I did was calculate the difference in years, so you have the age that person becomes in the $now year. Then I look at the month -> is it smaller than the month of the birthday, the age is one less. If this is not the case, check if it is the same month. If so, I needed to check the day of the month.
So, is this accurate?
Thanks a lot for your feedback.