What are the best practices for handling line breaks in PHP code to ensure compatibility and maintainability?

When handling line breaks in PHP code, it's important to use the PHP_EOL constant instead of hardcoding line breaks with "\n" or "\r\n". This ensures compatibility across different operating systems (Windows, Unix, etc.) and maintains code readability. Additionally, using the PHP_EOL constant makes it easier to update line breaks in the future if needed.

// Bad practice: hardcoding line breaks
echo "Line 1\nLine 2\r\nLine 3";

// Good practice: using PHP_EOL constant
echo "Line 1" . PHP_EOL . "Line 2" . PHP_EOL . "Line 3";