What potential issues can arise when handling line breaks in PHP when reading from and writing to text files?

When handling line breaks in PHP when reading from and writing to text files, a potential issue that can arise is inconsistent line break characters between different operating systems (e.g., Windows, Linux, macOS). This can lead to unexpected behavior when processing the text files. To solve this issue, you can normalize line breaks to a specific format (e.g., using PHP's `PHP_EOL` constant) when writing to the file and handle different line break characters when reading from the file.

// Normalize line breaks when writing to a text file
$fileContent = "Line 1" . PHP_EOL . "Line 2" . PHP_EOL;
file_put_contents('example.txt', $fileContent);

// Read from the text file and handle different line break characters
$fileLines = file('example.txt', FILE_IGNORE_NEW_LINES);
foreach ($fileLines as $line) {
    echo $line . PHP_EOL;
}