Skip to content

Instantly share code, notes, and snippets.

@Uriel29
Created September 12, 2014 17:02
Show Gist options
  • Save Uriel29/65981117d3c5ba4d4ea2 to your computer and use it in GitHub Desktop.
Save Uriel29/65981117d3c5ba4d4ea2 to your computer and use it in GitHub Desktop.
Removendo acentos, convertendo espaços em hífen e convertendo para minúsculos utilizando Regex, strtolower e strtr no seblod.
<?php
$variavel = $cck->getValue('seu_campo');
$variavel_limpa = strtolower( ereg_replace("[^a-zA-Z0-9-]", "-", strtr(utf8_decode(trim($variavel)), utf8_decode("áàãâéêíóôõúüñçÁÀÃÂÉÊÍÓÔÕÚÜÑÇ"),"aaaaeeiooouuncAAAAEEIOOOUUNC-")) );
echo $variavel_limpa;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment