codice:
$pattern = "#\d{8}#";
function inverti($matches) {
return substr($matches[0],6,2).'/'.substr($matches[0],4,2).'/'.substr($matches[0],0,4);
}
echo preg_replace_callback($pattern,'inverti',$stringa);