a simple way to calculate the age of someone
function age($format,$birthday,$today)
{
$birthday_ex = explode("$format",$birthday);
$actdate_ex = explode("$format",$today);
$tempage = ($actdate_ex[2] - $birthday_ex[2]);
$birth = mktime(0,0,0,$actdate_ex[0],$actdate_ex[1]);
$now = mktime(0,0,0,$birthday_ex[0],$birthday_ex[1]);
if ( $now < $birth)
{
$age = $tempage ;
echo $age;
}
else
{
$age = $tempage - 1 ;
echo $age;
}
}
Monday, December 17, 2007
Calculate The Age
POSTED BY
Oriol
AT
6:45 PM