Descrição: Melhora a função strtolower.
---------------------------------------------------------
Sintaxe: strtolower2 ( STR TEXTO )
Retorno: String
Descrição: Esta função eh uma versão da strtolower só que esta traduz os caracteres com acentos.
Bibliotecas: Nenhuma
Limitações: PHP 3.0+
Função:
<?php
function strtolower2($texto) {
$palavra = "";
$txt = strtolower($texto);
$trocar['Á'] = 'á';
$trocar['À'] = 'à';
$trocar['Â'] = 'â';
$trocar['Ã'] = 'ã';
$trocar['Ä'] = 'ä';
$trocar['É'] = 'é';
$trocar['È'] = 'è';
$trocar['Ê'] = 'ê';
$trocar['Ë'] = 'ë';
$trocar['Í'] = 'í';
$trocar['Ì'] = 'ì';
$trocar['Î'] = 'î';
$trocar['Ï'] = 'ï';
$trocar['Ó'] = 'ó';
$trocar['Ò'] = 'ò';
$trocar['Ô'] = 'ô';
$trocar['Õ'] = 'õ';
$trocar['Ö'] = 'ö';
$trocar['Ú'] = 'ú';
$trocar['Ù'] = 'ù';
$trocar['Û'] = 'û';
$trocar['Ü'] = 'ü';
$trocar['Ç'] = 'ç';
$trocar['Æ'] = 'æ';
for($i=0; $i<=strlen($txt); $i++) {
$a = substr($txt, $i, 1);
if(array_key_exists("$a",$trocar)){
$palavra .= $trocar[$a];
}else{
$palavra .= substr($txt, $i, 1);
}
}
return $palavra;
}
print strtolower2("TËSTÀNÔ ÊSTÉ SCRÏPT");
?>
flw'ss



Postagens
Male
