What are \r and \n meaning in PHP?

后端 未结 7 2101
难免孤独
难免孤独 2020-12-10 03:20

what are these called \\r \\n and is there a tutorial that explains them?

7条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-10 03:38

    "\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

提交回复
热议问题