note 17432 added to function.mktime

From: Date: Sat, 08 Dec 2001 11:41:27 +0000
Subject: note 17432 added to function.mktime
Groups: php.notes 
Request: Send a blank email to php-notes+get-22067@lists.php.net to get a copy of this message
REGARDING ABOVE NOTE ON CALCULATING AGE... Because of strange possibilities mentioned (due to varying platforms, servers, versions etc.), I would improve the above age calculating code in 2 ways: 1. Go ahead and plug in a safe year (any 4-digit year above 1970) for the 2 usages of mktime instead of zero -- make sure the years are the same though! 2. Go ahead and make sure that when you setup the $bday_mm_dd and $today_mm_dd variables that you use the same format regarding leading zeros. In other words, if $bday uses leading zeros, use date("m") and date("d") when assigning $today_mm_dd. Otherwise, use date("n") and date("j"). That's all. (Just to be safe.) -DON -- http://www.php.net/manual/en/function.mktime.php http://master.php.net/manage/user-notes.php?action=edit+17432 http://master.php.net/manage/user-notes.php?action=delete+17432 http://master.php.net/manage/user-notes.php?action=reject+17432

« previous php.notes (#22067) next »