Obviously it's not "\r\n",which only fits windows,and will cause ^M on linux
Asked
Active
Viewed 8,867 times
2 Answers
12

Community
- 1
- 1

Matthew Flaschen
- 278,309
- 50
- 514
- 539
-
1
-
4Yes..., why would you need the newline of the client? For HTML, newlines don't matter. For most other cases, the protocol specifies which to use. – Matthew Flaschen Jun 13 '09 at 01:00
2
a new line in php is just "\n". should work on all platforms.

AvatarOfChronos
- 867
- 9
- 24
-
-
2Using "\n" has always worked for me as a newline in php. and I've worked in both Linux and Windows environments. – AvatarOfChronos Jun 13 '09 at 02:18
-
The new line \n should work across all systems as long as the data is being used by php, the problems with \n vs \r\n come up when the data is created by php but used by another application, for instance, you write a document on linux using the \n within php, this file is then opened in a windows document software and you might see "unexpected" abnormalities in the way the data displays. I quoted unexpected because we can expect them but somebody not knowing this might be surprised by the output. – CodingInTheUK Aug 14 '19 at 09:26