note 2861 rejected from function.checkdate by didou

From: Date: Sat, 16 Aug 2003 19:35:56 +0000
Subject: note 2861 rejected from function.checkdate by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-54428@lists.php.net to get a copy of this message
Note Submitter: ezra_freedman@yahoo.com ---- things to look out for... Because checkdate accepts years between 0 and 32767 inclusive, you may want to include a cutoff year in your code when checking dates entered in a form by users. i.e. checkdate(1,1,199) returns true, as this is a valid date. Another consequence of the range of years accepted is that checkdate(1,1,"") will return true. If a user leaves a year form field blank, php will turn this into an int (0) and checkdate will look up the date in the year 0. Fortunately, PHP recognizes 0 as a leap year, so checkdate(2,29,"") returns true.

« previous php.notes (#54428) next »