Skip to content

Instantly share code, notes, and snippets.

@escuccim
Created April 12, 2017 07:49
Show Gist options
  • Save escuccim/3d146df1089defe22f82cc8cfd24a9ef to your computer and use it in GitHub Desktop.
Save escuccim/3d146df1089defe22f82cc8cfd24a9ef to your computer and use it in GitHub Desktop.
PHP Function to Remove Accents from Strings
function unaccent($string)
{
return preg_replace('~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml|caron);~i', '$1', htmlentities($string, ENT_COMPAT, 'UTF-8'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment