if(preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/', $datein)){
//it's ok
}else{
//it's bad
}
This only checks the format and not the validity. E.g. 2003-09-31 will pass the check even though September doesn't have 31 days.
Moderator: General Moderators
Note: preg_match(), which uses a Perl-compatible regular expression syntax, is often a faster alternative to ereg().
jason wrote:Of course, anyone can simply replace the pregular expression from above with the ereg and get the same result with the function resulting in this:
matthijs wrote:What is $xadBits and were is it coming from? And what does checkdate look like?
Users browsing this forum: No registered users and 1 guest