Filter replace accented characters with accent-less equivalent


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  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;
  6.  
  7. }

URL: replace-accented-characters

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.