note 33103 deleted from function.mktime by sniper
| From: | sniper@php.net | Date: | Tue, 04 Nov 2003 13:10:14 +0000 |
| Subject: | note 33103 deleted from function.mktime by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-59868@lists.php.net to get a copy of this message | ||
Note Submitter: Danish Dude
----
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