What are the best practices for handling line breaks and formatting in PHP text output?
When outputting text in PHP, it's important to handle line breaks and formatting properly to ensure readability. One common practice is to use the PHP `nl2br()` function to convert newline characters into HTML line breaks. This allows for proper formatting when displaying text on a webpage.
$text = "This is some text with\na line break.";
echo nl2br($text);