note 33103 added to function.mktime

From: Date: Tue, 17 Jun 2003 01:59:30 +0000
Subject: note 33103 added to function.mktime
Groups: php.notes 
Request: Send a blank email to php-notes+get-50450@lists.php.net to get a copy of this message
Hmmm I think I found the esiest way to compute a persons age Looked at some of the others and they quite didnt do the trick for me, anyway here goes function age($born){ if(eregi("^([0-9]{4})-([0-1][0-9])-([0-3][0-9])$", $born, $datearr)) { $age = date("Y")-$datearr[1]; if( date("Y-m-d") < (date("Y")."-".$datearr[2]."-".$datearr[3] ) ){ $age = $age-1; } return $age; } return false; } Hope this will be helpful for someone? Danish Dude ---- Manual Page -- http://www.php.net/manual/en/function.mktime.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33103 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33103&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33103&report=yes

« previous php.notes (#50450) next »