Replace special characters

3

I have a file in php that searches for files inside a directory (folder) the file is called (# file # example.mp3) and the link of that file is saved in an array

 $files[] = array(
                    "name" => $f,
                    "type" => "folder",
                    "path" => $dir . '/' . $f,
                    "items" => scan($dir . '/' .  $f) // <-- aqui es donde me obtiene el link para acceder, necesito reemplazar los caracteres # por _

could you help me ... Thanks

    
asked by Daniel Garcés 19.05.2016 в 00:27
source

1 answer

3

You can do it with the function str_replace ()

echo str_replace("#","_","un#archivo#mio"); // Salida: un_archivo_mio

See Demo

    
answered by 19.05.2016 в 00:46