While I agree with the approach used in this article I still have to point out that this will not work for email addresses. The reason is internationalization. Let’s say you have an address like post@øl.no (www.øl.no) is a valid domain with content. This method will return false.

So to be sure that your email validation actually is 100% successfull in all cases you will have to do use idn_to_ascii():

$email = ‘post@øl.no’;
list($user, $domain) = explode(‘@’, $email);
$user = idn_to_ascii($user);
$domain = idn_to_ascii($domain);
$email = $user . ‘@’ . $domain;
$result = filter_var($email, FILTER_VALIDATE_EMAIL);

This will convert the user and domain to the same format used by DNS servers when resolving internationalized domain names.

PS: You will have to have PHP’s intl module installed to be able to use the idn_* functions