What are these called? \r
, \n
Is there a tutorial that explains them?
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.)
\r
is the carriage return
\n
is the newline
These are available in many other languages aside from PHP.
They're escape sequences. \n
is a newline and \r
is a carriage return.
In Windows most text editors have a newline as \r\n and on unix it's \n
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With