How can the str_replace function be used to replace line breaks with HTML line breaks in PHP?
To replace line breaks with HTML line breaks in PHP, you can use the str_replace function to replace "\n" with "<br>". This allows you to display text with line breaks in an HTML format.
$text = "This is a text with\nline breaks.";
$html_text = str_replace("\n", "<br>", $text);
echo $html_text;