Created
December 13, 2017 17:32
-
-
Save calevano/45a00a5aa9ff89ed2e9269f09652522c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?hp | |
function url_amigable($url) { | |
//$urlMinuscula = strtolower($url); | |
$buscarLetra = array('Á', 'É', 'Í', 'Ó', 'Ú', 'Ñ', 'á', 'é', 'í', 'ó', 'ú', 'ñ'); | |
$reemplazar = array('A', 'E', 'i', 'O', 'U', 'N', 'a', 'e', 'i', 'o', 'u', 'n'); | |
$urlNueva = str_replace($buscarLetra, $reemplazar, $url); | |
$buscarCaracteres = array(' ', '&', '\r\n', '\n', '+'); | |
$urlAceptable = str_replace($buscarCaracteres, ' ', $urlNueva); | |
//$find = array('/[^a-z0-9\-<>]/', '/[\-]+/', '/<[^>]*>/'); | |
//$repl = array('', '-', ''); | |
//$urlRetornar = preg_replace($find, ' ', $urlAceptable); | |
return $urlAceptable; | |
} | |
$mensaje = 'Húmberto á - " enrique *][___?=?)=(= ashdasd Ámparo '; | |
echo url_amigable($mensaje); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Clean tilde and caracter special in text