note 35772 deleted from function.checkdate by vincent

From: Date: Fri, 19 Sep 2003 13:53:39 +0000
Subject: note 35772 deleted from function.checkdate by vincent
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-56767@lists.php.net to get a copy of this message
Note Submitter: jlamberg@cc.helsinki.fi.invalid ---- A validity enhancement to the previous note using is_numeric in addition to checkdate: Since the checkdate function has a bug in it (bug #25530), I think you should be checking for is_int() instead of is_numeric(), at least before the bug is fixed. // Example 1 $day = "4e4"; $mon = "5"; $year = "2000"; if (is_numeric($day) && is_numeric($mon) && is_numeric($year) && checkdate( $mon, $day, $year )) { echo "Valid 1"; } // Result: prints 'Valid 1' // Example 2 if (is_int($day) && is_int($mon) && is_int($year) && checkdate( $mon, $day, $year )) { echo "Valid 2"; } // Result: prints nothing I hope you can see the difference.

« previous php.notes (#56767) next »