What are the different types of line breaks that can be encountered in PHP (\r, \r\n, \n)?
Different types of line breaks that can be encountered in PHP include \r (carriage return), \r\n (carriage return followed by a newline), and \n (newline). When working with text files or data that may have different line break characters, it is important to handle them appropriately to ensure consistent behavior across different platforms. One way to normalize line breaks is to use the PHP function `str_replace()` to replace all types of line breaks with a single type, such as \n.
// Normalize line breaks to \n
$text = str_replace(array("\r\n", "\r"), "\n", $text);