note 57099 deleted from function.checkdate by cece

From: Date: Tue, 15 Nov 2005 14:40:48 +0000
Subject: note 57099 deleted from function.checkdate by cece
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-98598@lists.php.net to get a copy of this message
Note Submitter: beamer.boyle(A)gmail(DOT)com ---- just a slight problem the explode function needs the $date var adding. right <?php if (count($datebits=explode('-',$date))!=3) return false; ?> orig <?php if (count($datebits=explode('-'))!=3) return false; ?> so the entire working thing with earlier array corrected is <?php function datecheck($date, $yearepsilon=5000) { if (count($datebits=explode('-',$date))!=3) return false; $month = intval($datebits[0]); $day = intval($datebits[1]); $year = intval($datebits[2]); if ((abs($year-date('Y'))>$yearepsilon) || // year outside given range ($month<1) || ($month>12) || ($day<1) || (($month==2) && ($day>28+(!($year%4))-(!($year%100))+(!($year%400)))) || ($day>30+(($m>7)^($m&1)))) return false; // date out of range return array( 'year' => $year, 'month' => $month, 'day' => $day, ); } ?>

« previous php.notes (#98598) next »