Last active
August 17, 2023 09:26
-
-
Save sneycampos/f929e0f31282d8adc73428a90938578e to your computer and use it in GitHub Desktop.
PHP function to remove accents
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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