note 29430 modified in function.str-replace by aidan
| From: | aidan@php.net | Date: | Fri, 25 Jun 2004 06:07:36 +0000 |
| Subject: | note 29430 modified in function.str-replace by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-71644@lists.php.net to get a copy of this message | ||
how to remove accents from text
<?php
function accents($text) {
global $export;
$search = array ('ç', 'á', 'é', 'í', 'ó',
'ú', 'ã', 'õ', 'â', 'ê', 'î',
'ô', 'û');
$replace = array ('c', 'a', 'e', 'i', 'o',
'u', 'a', 'o', 'a', 'e', 'i',
'o', 'u');
$export = str_replace($search, $replace, $text);
return $export;
}
accents("Carnaval é só no Brasil");
?>
--was--
how to remove accents from text
function accents($text) {
global $export;
$search = array ('ç', 'á', 'é', 'í', 'ó',
'ú', 'ã', 'õ', 'â', 'ê', 'î',
'ô', 'û');
$replace = array ('c', 'a', 'e', 'i', 'o',
'u', 'a', 'o', 'a', 'e', 'i',
'o', 'u');
$export = str_replace($search, $replace, $text);
return $export;
}
accents("Carnaval é só no Brasil");
http://php.net/manual/en/function.str-replace.php