Skip to content

Instantly share code, notes, and snippets.

@sneycampos
Last active August 17, 2023 09:26
Show Gist options
  • Save sneycampos/f929e0f31282d8adc73428a90938578e to your computer and use it in GitHub Desktop.
Save sneycampos/f929e0f31282d8adc73428a90938578e to your computer and use it in GitHub Desktop.
PHP function to remove accents
<?php
$b = 'González';
function Unaccent($string)
{
return preg_replace('~&([a-z]{1,2})(acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i', '$1', htmlentities($string, ENT_QUOTES, 'UTF-8'));
}
Unaccent($b);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment