note 51262 deleted from function.str-replace by felipe
| From: | felipe@php.net | Date: | Sun, 06 Jan 2008 12:49:15 +0000 |
| Subject: | note 51262 deleted from function.str-replace by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-134882@lists.php.net to get a copy of this message | ||
Note Submitter: joaquin at metaltoad dot com
----
This is an another accent remover which converts foreign characters to their English equivilent. It
converts any character's to their HTML value and then uses preg_replace to find the desired
value. The function is based on a earlier entry: replace_accents.
function remove_accents( $string )
{
$string = htmlentities($string);
return preg_replace("/&([a-z])[a-z]+;/i","$1",$string);
}
example:
$string = "êéçýCÉÇÀ";
echo remove_accents( $string );
// will output: eecyCECA