What is the common method to replace line breaks in a string in PHP?
When dealing with strings in PHP, it is common to encounter line breaks that may need to be replaced or removed. One common method to replace line breaks in a string is to use the `str_replace()` function. By using this function, you can specify the line break characters you want to replace and the replacement character.
$string = "Hello\nWorld!";
$replaced_string = str_replace("\n", " ", $string);
echo $replaced_string;