Ver Mensaje Individual
  #4 (permalink)  
Antiguo 20/05/2007, 20:47
narunet
 
Fecha de Ingreso: mayo-2007
Mensajes: 4
Antigüedad: 17 años, 9 meses
Puntos: 0
Re: Problemas con strtr

¡Hola geq! ¡MUCHAS GRACIAS POR RESPONDER!

Bueno, lo que me has propuesto ya la había probado, pero tampoco funcionó...

He estado dándole muchas vueltas al tema y creo que todo se debe al urlencode, así que al final lo he intentado solucionar de otra manera. He creado esta función:

Código PHP:
function get_clean_words($clean_word '') {

$clean_word strtolower($clean_word);

$clean_word str_replace('á''a'$clean_word);
$clean_word str_replace('à''a'$clean_word);
$clean_word str_replace('é''e'$clean_word);
$clean_word str_replace('è''e'$clean_word);
$clean_word str_replace('í''i'$clean_word);
$clean_word str_replace('ì''i'$clean_word);
$clean_word str_replace('ó''o'$clean_word);
$clean_word str_replace('ò''o'$clean_word);
$clean_word str_replace('ú''u'$clean_word);
$clean_word str_replace('ù''u'$clean_word);
$clean_word str_replace('ü''u'$clean_word);
$clean_word str_replace('ñ''n'$clean_word);
$clean_word str_replace('ç''c'$clean_word);
$clean_word str_replace('@''A'$clean_word);
$clean_word str_replace('€''E'$clean_word);
$clean_word str_replace('$''S'$clean_word);
$clean_word str_replace('&''n'$clean_word);
$clean_word str_replace('_''-'$clean_word);
$clean_word str_replace('¡'''$clean_word);
$clean_word str_replace('!'''$clean_word);
$clean_word str_replace('¿'''$clean_word);
$clean_word str_replace('?'''$clean_word);
$clean_word str_replace('%'''$clean_word);
$clean_word str_replace('/'''$clean_word);
$clean_word str_replace('('''$clean_word);
$clean_word str_replace(')'''$clean_word);
$clean_word str_replace('='''$clean_word);
$clean_word str_replace('*'''$clean_word);
$clean_word str_replace(','''$clean_word);
$clean_word str_replace('.'''$clean_word);
$clean_word str_replace(';'''$clean_word);
$clean_word str_replace(':'''$clean_word);
$clean_word str_replace('º'''$clean_word);
$clean_word str_replace('ª'''$clean_word);

return 
$clean_word;


Así que ahora cuando quiero "limpiar" algo lo paso por la función y ya está:

Código PHP:
$image_name get_clean_words($row['image_name']); 
Funciona bien, pero tengo una duda de principiante (que es lo que soy): ¿cómo puedo simplificar el código? Es decir, ¿puedo resumir todas esas líneas en una sóla o da igual que lo deje así?

¡GRACIAS!