What's the difference between \n and \r (I know it has something to do with OS), and what's the best way to echo a line break that will work cross platform?
EDIT: In response to Jarod, I'll be using ths to echo a line break in a .txt log file, though I'm sure I'll be using it in the future for things such as echoing HTML makup onto a page.
\n
is a Linux/Unix line break.\r
is a classic Mac OS (non-OS X) line break. Mac OS X uses the above unix \n
.\r\n
is a Windows line break.I usually just use \n
on our Linux systems and most Windows apps deal with it ok anyway.