How can str_replace function be utilized to manipulate line breaks in PHP text processing?

When processing text in PHP, line breaks can sometimes cause formatting issues. The str_replace function can be used to manipulate line breaks by replacing them with a desired character or removing them altogether. This can help ensure consistent formatting across different platforms or applications.

// Example of using str_replace to manipulate line breaks
$text = "Hello\nWorld\n";
$processed_text = str_replace("\n", "<br>", $text);
echo $processed_text;