note 33468 added to function.mktime
| From: | wahoo at cyberdreamers dot org | Date: | Thu, 26 Jun 2003 23:24:29 +0000 |
| Subject: | note 33468 added to function.mktime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-51064@lists.php.net to get a copy of this message | ||
my 2 cents for the 'most-elegant-way-to-get-someone's-age':
function age($bday)
{
$c = getdate(); /* current */
$b = getdate($bday); /* birthday */
$age = $c[year] - $b[year];
if (time() < mktime($b[hours], $b[minutes], $b[seconds], $b[mon], $b[mday], $c[year]))
{
$age--;
}
return $age;
}
----
Manual Page -- http://www.php.net/manual/en/function.mktime.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33468
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33468&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33468&report=yes