Is there a best practice for handling line breaks in PHP scripts to ensure consistent behavior across different servers?

When working with PHP scripts, it's important to consider the differences in line break characters between different operating systems (e.g., Windows, Unix, macOS). To ensure consistent behavior across servers, it's recommended to use the PHP_EOL constant, which represents the correct line break character for the current platform. By using PHP_EOL instead of hardcoding line breaks, your scripts will be portable and work correctly on any server.

// Example of using PHP_EOL to handle line breaks
$text = "This is a line of text." . PHP_EOL;
file_put_contents('output.txt', $text, FILE_APPEND);