/***************************************************************************************** * CalcAge * * 2006.09.22 - Eugen Tropmann * * * Calc the Age * * Parameter: * $birthday = 1.9.1965 *****************************************************************************************/ function CalcAge($birthday){ //Explode the Birthday and create the Array bDay. $bDay = explode(".",$birthday); //Create the Timestamp for now $now = mktime(0,0,0,date("m"),date("d"),date("Y")); //Create the Timestamp for the birthday $birthday = mktime(0,0,0,$bDay[1],$bDay[0],$bDay[2]); //Calc the age $age = intval(($now - $birthday) / (3600 * 24 * 365)); //Logic if(($age > 0) AND ($bDay[2] <= date("Y"))){ return $age; }else{ return false; } }