$string = str_replace(array("\n", "\r"), '', $string);

veya

$string = preg_replace('~[\r\n]~', '', $string);