Remove new line character from a string PHP
To remove the new line character from a string, we can use the
str_replace() function by passing
\n regex as an argument in PHP.
Here is an example:
$string = " Hello Google "; $string = str_replace("\n", " ", $string); echo $string;