Ver Mensaje Individual
  #1 (permalink)  
Antiguo 02/01/2013, 18:07
andrwyo2006
 
Fecha de Ingreso: junio-2012
Mensajes: 77
Antigüedad: 11 años, 10 meses
Puntos: 5
[PHP] Simplificar funcion

Buenas Noches
Tengo la siguiente funcion y me gustaria poder simplificarla para que en caso de querer cambiar el lenguaje o la cadena de reemplazo me sea mucho mas facil que todo lo que tengo aqui...

muchas gracias

Código PHP:
/*
 * Tabla de Conversion
 *         1    2    3            1    2    3            1    2    3
    1    a    b    c        1    j    k    l        1    s    t    u
#1    2    d    e    f    #2    2    m    n    o    #3    2    v    w    x
    3    g    h    i        3    p    q    r        3    y    z

Ejem: a=tabla1,fila1,columna1
      j=tabla2,fila1,columna1
      s=tabla3,fila1,columna1
      Hola=132 223
 */

function replace($text) {
$textemp=$text;

$textr=str_replace("a","111*",$textemp);
$textr=str_replace("b","112*",$textr);
$textr=str_replace("c","113*",$textr);
$textr=str_replace("d","121*",$textr);
$textr=str_replace("e","122*",$textr);
$textr=str_replace("f","123*",$textr);
$textr=str_replace("g","131*",$textr);
$textr=str_replace("h","132*",$textr);
$textr=str_replace("i","133*",$textr);
$textr=str_replace("j","211*",$textr);
$textr=str_replace("k","212*",$textr);
$textr=str_replace("l","213*",$textr);
$textr=str_replace("m","221*",$textr);
$textr=str_replace("n","222*",$textr);
$textr=str_replace("o","223*",$textr);
$textr=str_replace("p","231*",$textr);
$textr=str_replace("q","232*",$textr);
$textr=str_replace("r","233*",$textr);
$textr=str_replace("s","311*",$textr);
$textr=str_replace("t","312*",$textr);
$textr=str_replace("u","323*",$textr);
$textr=str_replace("v","321*",$textr);
$textr=str_replace("w","322*",$textr);
$textr=str_replace("x","323*",$textr);
$textr=str_replace("y","331*",$textr);
$textr=str_replace("z","332*",$textr);
$textr=str_replace(" ","333*",$textr);
$textr=str_replace("*"," ",$textr);
return 
$textr;