Skip to content

Instantly share code, notes, and snippets.

@milesleif
Last active August 29, 2015 14:18
Show Gist options
  • Select an option

  • Save milesleif/7cecf92c749a3d754918 to your computer and use it in GitHub Desktop.

Select an option

Save milesleif/7cecf92c749a3d754918 to your computer and use it in GitHub Desktop.
Encode eMails-adddresses to unicode
function encode_emails($string){
$pattern = "/[a-z0-9_\-\+]+@[a-z0-9\-]+\.([a-z]{2,3})(?:\.[a-z]{2})?/i";
preg_match_all($pattern, $string, $split);
foreach ($split[0] as $value) {
$clean_value = antispambot($value);
$string = str_replace($value, $clean_value ,$string);
}
return $string;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment