Remove string accents in PHP
 28 August 2017
 Php
 Rodrigo Costa Corrêa
Function created in PHP to remove string accents.
public static function removeAccent($str) {
		$from = ' àáâãäèéêëìíîïòóôõöùúûüÀÁÂÃÄÈÉÊËÌÍÎÒÓÔÕÖÙÚÛÜçÇñÑ';
		$to = ' aaaaaeeeeiiiiooooouuuuAAAAAEEEEIIIOOOOOUUUUcCnN';
		
		$keys = array ();
		$values = array ();
		preg_match_all ( '/./u', $from, $keys );
		preg_match_all ( '/./u', $to, $values );
		$mapping = array_combine ( $keys [0], $values [0] );
		return strtr ( $str, $mapping );
	}
Use Example:
removeAccent ("bênção")
// Result: bencao