As aforesaid. Nonetheless, my first contribution in such a long while will exalt you, mi amigo:
PHP Code:
/* Oh, Wildhoney to the rescue! TalkPHP.com loves you. */
function date_age($iBirthDay, $iBirthMonth, $iBirthYear)
{
/* Determine the current date, sunshine. */
list($iCurrentDay, $iCurrentMonth, $iCurrentYear) = array(date('j'), date('n'), date('Y'));
/* Quick guess -- maybe incorrect guess at the age. */
$iAge = $iCurrentYear - $iBirthYear;
/* Was the individual born before the current month, if so, we were right first time. */
if ($iBirthMonth < $iCurrentMonth)
{
return $iAge;
}
/* It's my birthday and I'll cry if I want to. */
if ($iBirthDay <= $iCurrentDay && $iBirthMonth == $iCurrentMonth)
{
/* Without a time, we'll assume the individual's birth time has passed. */
return $iAge;
}
/* Lucky individual still has birthday presents to look forward to sometime THIS year. */
return $iAge - 1;
}
printf("Age: %d<br />", date_age(10, 10, 1985));
printf("Age: %d<br />", date_age(10, 2, 1985));
printf("Age: %d<br />", date_age(12, 8, 1985));
printf("Age: %d<br />", date_age(12, 6, 1989));
printf("Age: %d<br />", date_age(12, 16, 1899));