Looked everywhere on the internet for an answer to this without much luck, so here I am. I've been dissecting scripts purchased off of the CodeCanyon.net site to learn OOP and I've noticed that a lot of lines end in /r/n. Why is this common practice, and what is the practical use? Thanks in advance!
Asked
Active
Viewed 210 times
0
-
Are they HTTP header strings? – Seth Carnegie Jan 11 '13 at 16:38
-
5Are you sure it's /r/n and not \r\n? – BoltClock Jan 11 '13 at 16:39
-
the proper line ending to use depends on what your specifically producing. outputing html? it doesnt matter. http headers? the spec requires \r\n. mime headers for emails? it depends on the specific mail transfer agent that runs on the system. a text file? \r\n for win, \n for linux, \r for really really old school mac. – goat Jan 11 '13 at 17:01
3 Answers
7
Taken from here
\r\n are end of line characters for Windows systems.
\n is the end of line character for UNIX systems.
It is to ensure cross-OS compatibility.

Community
- 1
- 1

PlantTheIdea
- 16,061
- 5
- 35
- 40
1
This depends on your Operating system. For Unix based system \n works fine but Windows needs the \r\n
\r is a carriage return
and
\n a linefeed
in case you want to look those up

Stefan
- 2,164
- 1
- 23
- 40