Skip to content
Advertisement

Remove newline character from a string using PHP regex

How can I remove a new line character from a string using PHP?

Advertisement

Answer

$string = str_replace("n", "", $string);
$string = str_replace("r", "", $string);
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement