Re: replace accents
| From: | Rick Fletcher | Date: | Tue, 14 Sep 2004 17:04:39 +0000 |
| Subject: | Re: replace accents | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-196635@lists.php.net to get a copy of this message | ||
Diana Castillo wrote:
Anyone know of any function to replace letters with accents with just the regular letter, for instance replace á with a, ç with c, ñ with n ?found this on the strtr() manual page (http://php.net/strtr): <?php function removeaccents($string){ return strtr(
strtr( $string,
'ŠŽšžŸÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ',
'SZszYAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy' ),
array(
'Þ' => 'TH', 'þ' => 'th', 'Ð' => 'DH', 'ð' => 'dh',
'ß' => 'ss', 'Œ' => 'OE', 'œ' => 'oe', 'Æ' => 'AE',
'æ' => 'ae', 'µ' => 'u' )
);
}
?>
--rick