What are the differences between "\n", "\r", and "\r\n" in PHP and how do they affect text formatting?

The differences between "\n", "\r", and "\r\n" lie in how they represent line breaks in text. "\n" represents a line feed, moving the cursor to the next line. "\r" represents a carriage return, moving the cursor to the beginning of the line. "\r\n" represents a carriage return followed by a line feed, commonly used in Windows systems for line breaks. When working with text formatting in PHP, it's important to use the appropriate line break character based on the platform you are working with to ensure proper formatting.

```php
// Example of using different line break characters in PHP
$text = "Line 1\r\nLine 2\r\nLine 3";
echo $text;
```

In this example, "\r\n" is used to create line breaks in the text, which is commonly used in Windows systems. Make sure to use the appropriate line break character based on the platform you are working with to ensure consistent text formatting.