E' esattamente quello che fa il codice che hai postato, a parte il fatto che essendo la \ un carattere di escape che normalmente si usa com \n o \r, va scirtta come doppia: \\

$stringa=str_replace("\\","",$stringa);