note 87493 deleted from function.str-replace by philip
| From: | philip@php.net | Date: | Wed, 07 Oct 2009 07:57:20 +0000 |
| Subject: | note 87493 deleted from function.str-replace by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-161445@lists.php.net to get a copy of this message | ||
Note Submitter: Daniel Vidal
----
Substituindo caracteres acentuados em uma string (português)
If you need change portugues chars to ansi chars, try this
$com_acentos=array(
"á","Ã","ã","Ã",
"â","Ã","à ","Ã",
"é","Ã","ê","Ã",
"Ã","Ã","ó","Ã",
"õ","Ã","ô","Ã",
"ú","Ã","ü","Ã",
"ç","Ã");
$sem_acentos=array(
"a","A","a","A",
"a","A","a","A",
"e","E","e","E",
"i","I","o","O",
"o","O","o","O",
"u","U","u","U",
"c","C");
$input_string = 'Ações em Alta. Série
positiva:[áéÃóúÃÃÃÃÃçÃ]';
$output_string = str_replace($com_acentos,$sem_acentos,$input_string);
echo 'input_string : ' . $input_string . " <br />\n";
echo 'output_string: ' . $output_string . " <br />\n";
-------------------
Your will get:
input_string : Ações em Alta. Série
positiva:[áéÃóúÃÃÃÃÃçÃ]
output_string: Acoes em Alta. Serie positiva:[aeiouAEIOUcC]