Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/03/2009, 10:42
charlyta
 
Fecha de Ingreso: junio-2008
Mensajes: 291
Antigüedad: 15 años, 10 meses
Puntos: 9
Problema con substr

Hola! estoy haciendo un juego con php y me da un error extraño. lo que hago es que si el jugador acierta me muestra tres imágenes de una carpeta. este es el código:
Código PHP:
// ---------------------------
// GetTreatement(<code>,<opt>)
// ---------------------------
// call: $file=GetTreatement('31b33',2);function GetTreatement($code,$opt)
{
    
$index[1]="a"$index[2]="b"$index[3]="c";
    
$xfile=OS_Path("/images/game/treats/xray/".substr($code,0,2)."/".$code.$index[$opt].".jpg");
    
$zfile=OS_Path("/images/game/treats/zoom/".substr($code,0,2)."/".$code.$index[$opt].".jpg");

    if (
file_exists($xfile) && file_exists($zfile))
    {
        
$file=substr($code,0,2)."/".$code.$index[$opt].".jpg";
    }
    else
    {
        
$file="00/0.jpg";        
    }
    
    return(
$file);
}
// return: '31/31b33a.jpg' or '00/0,jpg' if 
the files doesnt exist


creo que es un error en el substr pero no caigo...aguna idea?? mil gracias