I have this code:
preg_match_all('#href="/mp3/(.*?).html#', $content, $salida);
and I need to replace "_" to " " (space) in output (array), something like this
$salida = str_replace('_', ' ', $salida);
obviously that code does not work
I think what you're looking for is preg_replace_callback
$salida = preg_replace_callback(
'(href="/mp3/.*?\.html)',
function($m) {return str_replace("_","",$m[0]);},
$content);