Posted By

pikilon on 01/22/13



Versions (?)

Clear accents easy and fast

 / Published in: PHP

It is a simple function that remove accents and puts its closest equivalent throught htmlentities and preg_replace, very useful for SEF url and aliases

  1. function quitaAcentos($string,$lowercase=true) {
  2. $string = preg_replace('`&(\w)[^;]+;`','$1',htmlentities($string));
  3. $string = $lowercase ? strtolower($string) : $string;
  4. return $string;
  5. }
  6. // echo quitaAcentos("copón") will show "copon"

Report this snippet  

You need to login to post a comment.