Posted By

Roen on 10/25/10


php filter accents pregreplace special-characters accented-characters url-slug

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Filter replace accented characters with accent-less equivalent

 / Published in: PHP

URL: replace-accented-characters

  1. function filter_accented_characters($stringWithAccentedCharacters) {
  2. $search = explode(",","ç,æ,œ,á,é,í,ó,ú,à,è,ì,ò,ù,ä,ë,ï,ö,ü,ÿ,â,ê,î,ô,û,å,e,i,ø,u");
  3. $replace = explode(",","c,ae,oe,a,e,i,o,u,a,e,i,o,u,a,e,i,o,u,y,a,e,i,o,u,a,e,i,o,u");
  4. $stringWithReplacedCharacters = $urlTitle = str_replace($search, $replace, $stringWithAccentedCharacters);
  5. return $stringWithReplacedCharacters;
  7. }

Report this snippet  


RSS Icon Subscribe to comments
Posted By: Roen on October 25, 2010

Found on removing accented utf-8 characters with php You can use this function as an alternate to setlocale() in cubic, the perfect php clean generator.

Posted By: Roen on October 25, 2010

cubic is the perfect clean url generator

You need to login to post a comment.