Forse hai un testo con i caratteri "\r\n", prova a usare questa stringa nella funzione str_replace.
Regole del Forum