Skip to content

Instantly share code, notes, and snippets.

@dirkeinecke
Created July 12, 2018 06:09
Show Gist options
  • Save dirkeinecke/e8d7c8d16be04fb30f9962e8ed3364b2 to your computer and use it in GitHub Desktop.
Save dirkeinecke/e8d7c8d16be04fb30f9962e8ed3364b2 to your computer and use it in GitHub Desktop.
This PHP function checks if the email address is syntactically correct.
function check_email_address($email_address) {
if ($email_address !== '') {
$result = filter_var($email_address, FILTER_VALIDATE_EMAIL);
if ($result === FALSE) {
return false; // email address is not valid
} else {
return true; // email address is valid
}
} else {
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment