How would i go about creating custom filters for use in PHP filter_var().
An example:
Right now i have a function to validate a date:
private function validateDate($date){
$d = DateTime::createFromFormat('Y-m-d', $date);
return $d && $d->format('Y-m-d') == $date;
}
function was copied from this answer or php.net
I want to be able to call a constant like FILTER_VALIDATE_DATE and have it checked by the above code.
Any help is appreciated.