What are common challenges faced when implementing automatic line breaks in PHP?

One common challenge faced when implementing automatic line breaks in PHP is ensuring that the line breaks are applied consistently across different platforms and environments. To solve this, you can use the PHP function `nl2br()` which converts newlines to HTML line breaks.

$text = "This is a sample text with line breaks.";
echo nl2br($text);