[SOLVED] Is a new line = \n OR \r\n?

Issue

I’ve seen many developers use different methods to split a string by new lines, but i’m confused which is the correct: \r\n OR \n only?

Solution

\n is used for Unix systems (including Linux, and OSX).

\r\n is mainly used on Windows.

\r is used on really old Macs.

PHP_EOL constant is used instead of these characters for portability between platforms.

Answered By – icktoofay

Answer Checked By – Gilberto Lyons (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *