What are \r and \n meaning in PHP?

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

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

7条回答
  •  [愿得一人]
    2020-12-10 03:41

    They're "carriage return" and "line feed" respectively. Typically on Windows, you need both together to represent a line terminator: "\r\n" whereas on most (all?) Unix systems, "\n" is enough.

    See the Wikipedia Newline entry for more details about the vagaries of different systems.

    See the PHP manual for more details about escape sequences in general, and the other ones available in PHP.

    Many other languages (e.g. C, C++, C#, Java, Perl, Python, Ruby) share the same escape sequences for carriage return and line feed - but they are all specified for the individual language. (In other words, it is language specific, but the answer would be the same for many languages.)

提交回复
热议问题