halojoy wrote:For PHP the native is
only "\n"
There is no "native" line break in PHP. There's the PHP_EOL, which gives you the operating system's expected line break, and that's about it. It can parse PHP scripts, read files, etc. etc. with \r, \n, or \r\n.
Myth(UK) wrote:I do know this, but I find \n works on everything apart from macs.
Seems about right, since Macs use a carriage return (\r) for line endings, IIRC. Also, be careful about saying "everything" - try opening a file that uses Unix line endings (\n) on a Windows computer in Notepad.
As far as which line ending to use... I would say it depends on the situation. For example, in e-mail headers, you're supposed to use "\r\n" (unless you have a certain MTA that modifies line endings in headers and adds a carriage return in front of new line characters).
I tend to use "\n" in most cases just becase a) I'm usually only worried about *nix or Windows (sorry Mac lovers... well, almost sorry 😉), and b) "\n" is easier/faster to type than "\r\n" :p.