I tried PHP's built-in function: filter_input()
var_dump(filter_var('[email protected]', FILTER_VALIDATE_EMAIL));
Output:
string(19) "[email protected]"
Then I tried the latest release of Zend Framework (1.11.3):
$validator = new Zend_Validate_EmailAddress();
if ($validator->isValid('[email protected]')) {
echo 'OK';
} else {
foreach ($validator->getMessages() as $message) {
echo "$message\n";
}
}
Output:
'john.doe.' can not be matched against dot-atom format
'john.doe.' can not be matched against quoted-string format
'john.doe.' is no valid local part for email address '[email protected]'
Either the built-in function should return FALSE or the Zend method 'OK'.
My hubmle question is:
Which one is right?