note 87493 added to function.str-replace
| From: | DanielVidal at osu1 dot php dot net | Date: | Sun, 07 Dec 2008 12:48:58 +0000 |
| Subject: | note 87493 added to function.str-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-147782@lists.php.net to get a copy of this message | ||
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]
----
Server IP: 200.185.109.13
Probable Submitter: 189.7.158.120
----
Manual Page -- http://www.php.net/manual/en/function.str-replace.php
Edit -- https://master.php.net/note/edit/87493
Del: integrated -- https://master.php.net/note/delete/87493/integrated
Del: useless -- https://master.php.net/note/delete/87493/useless
Del: bad code -- https://master.php.net/note/delete/87493/bad+code
Del: spam -- https://master.php.net/note/delete/87493/spam
Del: non-english -- https://master.php.net/note/delete/87493/non-english
Del: in docs -- https://master.php.net/note/delete/87493/in+docs
Del: other reasons-- https://master.php.net/note/delete/87493
Reject -- https://master.php.net/note/reject/87493
Search -- https://master.php.net/manage/user-notes.php