Return to Snippet

Revision: 61886
at January 22, 2013 10:59 by pikilon


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

Initial URL

                                

Initial Description
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

Initial Title
Clear accents easy and fast

Initial Tags

                                

Initial Language
PHP