What do \r and \n mean in PHP (and other languages)?

Viewed 80370

What are these called? \r, \n

Is there a tutorial that explains them?

7 Answers

"\r" is Carriage return. Mind the double quotes when you use it with PHP! If you use single quotes, You will get the string \r instead of a line break.

BTW, it is suitable to use "\r\n" if you want to put a line break in your text so it will be rendered correctly in different operating systems.

  • Mac: \r
  • Linux/Unix: \n
  • Windows: \r\n
Related