note 111694 deleted from function.str-replace by mikemike

From: Date: Mon, 28 Apr 2014 15:28:26 +0000
Subject: note 111694 deleted from function.str-replace by mikemike
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-199358@lists.php.net to get a copy of this message
Note Submitter: Daniel Loureiro ---- if you need to remove accents of string (ex. if you are a portuguese speaker), you can use this: <?php function remove_accents($str) { $from = array( "á", "à", "â", "ã", "ä", "é", "è", "ê", "ë", "í", "ì", "î", "ï", "ó", "ò", "ô", "õ", "ö", "ú", "ù", "û", "ü", "ç", "Á", "À", "Â", "Ã", "Ä", "É", "È", "Ê", "Ë", "Í", "Ì", "Î", "Ï", "Ó", "Ò", "Ô", "Õ", "Ö", "Ú", "Ù", "Û", "Ü", "Ç" ); $to = array( "a", "a", "a", "a", "a", "e", "e", "e", "e", "i", "i", "i", "i", "o", "o", "o", "o", "o", "u", "u", "u", "u", "c", "A", "A", "A", "A", "A", "E", "E", "E", "E", "I", "I", "I", "I", "O", "O", "O", "O", "O", "U", "U", "U", "U", "C" ); return str_replace($from, $to, $str); } echo remove_accents("Açaí não é maçã"); ?>

« previous php.notes (#199358) next »