note 76281 modified in function.checkdate by danbrown

From: Date: Sun, 20 Jul 2008 02:30:30 +0000
Subject: note 76281 modified in function.checkdate by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-141966@lists.php.net to get a copy of this message
checkData function posted below does not consider a date entered such as 03/27c/2000. The c will cause it to crash. Here is the fix. <?php function checkData($mydate) { list($yy,$mm,$dd)=explode("-",$mydate); if (is_numeric($yy) && is_numeric($mm) && is_numeric($dd)) { return checkdate($mm,$dd,$yy); } return false; } ?> --was-- checkData function posted below does not consider a date entered such as 03/27c/2000. The c will cause it to crash. Here is the fix. function checkData($mydate) { list($yy,$mm,$dd)=explode("-",$mydate); if (is_numeric($yy) && is_numeric($mm) && is_numeric($dd)) { return checkdate($mm,$dd,$yy); } return false; } http://php.net/manual/en/function.checkdate.php

« previous php.notes (#141966) next »