Skip to content

Instantly share code, notes, and snippets.

@kasperhartwich
Created September 20, 2012 10:08
Show Gist options
  • Select an option

  • Save kasperhartwich/3755050 to your computer and use it in GitHub Desktop.

Select an option

Save kasperhartwich/3755050 to your computer and use it in GitHub Desktop.
Array stristr version
$illegal_domain_names = array(
'gmail.con',
'gamil.com',
'gail.com',
'gmil.com',
'gmail.co',
'hotnail.com',
'hormail.com',
'hotmail.con',
'hotmil.com',
'hotmial.com',
'hotmial.com',
'hotmail.cm',
);
if(preg_match('/' . implode('|', array_map('preg_quote', $illegal_domain_names)) . '/i', $email)) {
//Illegal domainname
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment