note 28260 added to function.checkdate
| From: | php dot net at irradour dot co dot uk | Date: | Tue, 07 Jan 2003 15:57:37 +0000 |
| Subject: | note 28260 added to function.checkdate | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-41794@lists.php.net to get a copy of this message | ||
As PHP converts strings that begin with numbers into numbers when using checkdate, it may be useful
to check if numbers are being used. For example:
checkdate('12','3 little pigs','2003')
will validate, even though you probably don't want it to.
To avoid this problem, use:
is_numeric($day) && is_numeric($mon) && is_numeric($year) && checkdate(
$mon, $day, $year )
--
http://www.php.net/manual/en/function.checkdate.php
http://master.php.net/manage/user-notes.php?action=edit+28260
http://master.php.net/manage/user-notes.php?action=delete+28260
http://master.php.net/manage/user-notes.php?action=reject+28260