What potential pitfalls should be considered when handling line breaks in PHP, especially in relation to different operating systems?

When handling line breaks in PHP, it's important to consider that different operating systems use different characters to represent line breaks. Windows uses "\r\n", Unix-based systems like Linux and macOS use "\n", and older Mac systems use "\r". To ensure cross-platform compatibility, it's best to use the PHP_EOL constant which represents the correct line break character for the current operating system.

// Use PHP_EOL to handle line breaks in a cross-platform way
$myText = "Hello" . PHP_EOL . "World";
echo $myText;