Skip to content

Instantly share code, notes, and snippets.

@erikfig
Created July 10, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erikfig/a67da84d45cbd739b802 to your computer and use it in GitHub Desktop.
Save erikfig/a67da84d45cbd739b802 to your computer and use it in GitHub Desktop.
function tirarAcentos($string){
return preg_replace(array("/(á|à|ã|â|ä)/","/(Á|À|Ã|Â|Ä)/","/(é|è|ê|ë)/","/(É|È|Ê|Ë)/","/(í|ì|î|ï)/","/(Í|Ì|Î|Ï)/","/(ó|ò|õ|ô|ö)/","/(Ó|Ò|Õ|Ô|Ö)/","/(ú|ù|û|ü)/","/(Ú|Ù|Û|Ü)/","/(ñ)/","/(Ñ)/"),explode(" ","a A e E i I o O u U n N"),$string);
}
echo tirarAcentos($string);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment