note 28260 deleted from function.checkdate by sniper
| From: | sniper@php.net | Date: | Sun, 14 Sep 2003 18:24:52 +0000 |
| Subject: | note 28260 deleted from function.checkdate by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-56476@lists.php.net to get a copy of this message | ||
Note Submitter: php.net@irradour.co.uk
----
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 )