note 87493 deleted from function.str-replace by philip

From: Date: Wed, 07 Oct 2009 07:57:20 +0000
Subject: note 87493 deleted from function.str-replace by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-161445@lists.php.net to get a copy of this message
Note Submitter: Daniel Vidal ---- Substituindo caracteres acentuados em uma string (português) If you need change portugues chars to ansi chars, try this $com_acentos=array( "á","Á","ã","Ã", "â","Â","à","À", "é","É","ê","Ê", "í","Í","ó","Ó", "õ","Õ","ô","Ô", "ú","Ú","ü","Ü", "ç","Ç"); $sem_acentos=array( "a","A","a","A", "a","A","a","A", "e","E","e","E", "i","I","o","O", "o","O","o","O", "u","U","u","U", "c","C"); $input_string = 'Ações em Alta. Série positiva:[áéíóúÁÉÍÓÚçÇ]'; $output_string = str_replace($com_acentos,$sem_acentos,$input_string); echo 'input_string : ' . $input_string . " <br />\n"; echo 'output_string: ' . $output_string . " <br />\n"; ------------------- Your will get: input_string : Ações em Alta. Série positiva:[áéíóúÁÉÍÓÚçÇ] output_string: Acoes em Alta. Serie positiva:[aeiouAEIOUcC]

« previous php.notes (#161445) next »