How does the use of "\n" for line breaks in PHP differ between Linux/Unix and Windows systems?

When using "\n" for line breaks in PHP, it is important to note that Linux/Unix systems use only "\n" for line breaks, while Windows systems use "\r\n". This can cause issues when creating files or displaying text across different operating systems. To ensure cross-compatibility, it is recommended to use the PHP constant PHP_EOL, which represents the correct line break character for the current operating system.

// Using PHP_EOL for line breaks to ensure cross-compatibility
$fileContent = "Line 1" . PHP_EOL . "Line 2" . PHP_EOL . "Line 3";
file_put_contents('file.txt', $fileContent);