note 78908 added to function.mktime
| From: | alexixalex at gmail dot com | Date: | Thu, 01 Nov 2007 20:21:12 +0000 |
| Subject: | note 78908 added to function.mktime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-131921@lists.php.net to get a copy of this message | ||
// 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;
}
}
----
Server IP: 212.24.129.51
Probable Submitter: 90.176.53.105
----
Manual Page -- http://www.php.net/manual/en/function.mktime.php
Edit -- https://master.php.net/note/edit/78908
Del: integrated -- https://master.php.net/note/delete/78908/integrated
Del: useless -- https://master.php.net/note/delete/78908/useless
Del: bad code -- https://master.php.net/note/delete/78908/bad+code
Del: spam -- https://master.php.net/note/delete/78908/spam
Del: non-english -- https://master.php.net/note/delete/78908/non-english
Del: in docs -- https://master.php.net/note/delete/78908/in+docs
Del: other reasons-- https://master.php.net/note/delete/78908
Reject -- https://master.php.net/note/reject/78908
Search -- https://master.php.net/manage/user-notes.php