Created
June 26, 2014 17:08
-
-
Save AlexSJ/e8afc003d817d86f2647 to your computer and use it in GitHub Desktop.
Helper para remover acentos das strings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Helper { | |
/** | |
* Remove acentos das strings | |
*/ | |
public static function removerAcentos($string) { | |
return strtr($string, array ( | |
'à' => 'a', 'á' => 'a', 'â' => 'a', 'ã' => 'a', 'ä' => 'a', 'å' => 'a', 'æ' => 'a', | |
'ç' => 'c', | |
'è' => 'e', 'é' => 'e', 'ê' => 'e', 'ë' => 'e', | |
'ì' => 'i', 'í' => 'i', 'î' => 'i', 'ï' => 'i', | |
'ð' => 'o', 'ò' => 'o', 'ó' => 'o', 'ô' => 'o', 'õ' => 'o', 'ö' => 'o', 'ø' => 'o', | |
'ñ' => 'n', | |
'ù' => 'u', 'ú' => 'u', 'û' => 'u', 'ý' => 'y', | |
'þ' => 'b', | |
'ÿ' => 'y')); | |
} | |
} | |
echo Helper::removerAcentos('áéíçãõúñ'); |
paulodiovani
commented
Jun 26, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment