Created
August 31, 2012 23:11
-
-
Save fabiancarlos/3560767 to your computer and use it in GitHub Desktop.
Limpa Strings para arquivos
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
<?php | |
public function clean_string($string){ | |
// troca palavras com acentos | |
$string = strtr($string, "áàãâéêíóôõúüçÁÀÃÂÉÊÍÓÔÕÚÜÇ ", "aaaaeeiooouucAAAAEEIOOOUUC_"); | |
// converte para caixa baixa | |
$string = strtolower($string); | |
// remove espaços em branco | |
$string = preg_replace('/\s+/', '_', $string); | |
return $string; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment