Validating Email in PHP

Validating email is more difficult than one might think. Recently I found this this code at PHP.net and I feel a need to republish this to emphasize its effectiveness and simplicity.

$email = "user@email.com";
if(!filter_var($email, FILTER_VALIDATE_EMAIL)) {
  echo "E-mail is not valid";
} else {
  echo "E-mail is valid";
}
Technologies: 
Actions: