Skip to content

Instantly share code, notes, and snippets.

@adlerdias
Created September 26, 2018 12:43
Show Gist options
  • Save adlerdias/4d3725862055bcb155d172d40f7c0339 to your computer and use it in GitHub Desktop.
Save adlerdias/4d3725862055bcb155d172d40f7c0339 to your computer and use it in GitHub Desktop.
PHP - Remove latin characters
namespace App\Helpers;
class Clear
{
/**
* Remove os caracteres acentuados da string
* @param string $string
* @return string
*/
public static function removerAcentuados(string $string) : string
{
$transliterator = \Transliterator::create('Any-Latin; Latin-ASCII; [\u0080-\u7fff] remove');
return $transliterator->transliterate($string);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment