How can PHP handle different types of line breaks (e.g., \r, \n, \r\n) when manipulating text files?

When manipulating text files in PHP, it's important to account for different types of line breaks (\r, \n, \r\n) that may be present in the file. One way to handle this is by using the PHP function `preg_split()` with a regular expression pattern that matches any type of line break. This will allow you to split the file content into an array of lines regardless of the line break type.

$fileContent = file_get_contents('example.txt');
$lines = preg_split('/\r\n|\r|\n/', $fileContent);

foreach ($lines as $line) {
    // Do something with each line
}