This article mainly introduces the difference between rrnt in php. For more information, see
This article mainly introduces the differences between \ r \ n \ t in php. For more information, see
\ N soft carriage return:
In Windows, it indicates a line break and returns to the starting position of the next line. It is equivalent to \ r in Mac OS.
In Linux and unix, it only indicates line breaks, but does not return to the starting position of the next line.
\ R Soft Space:
In Linux and unix, return to the starting position of the row.
In Mac OS, line breaks are displayed and returned to the start position of the next line, which is equivalent to \ n in Windows.
\ T hop (move to the next column ).
They are valid in double quotes or delimiters, and are invalid in single quotes.
\ R \ n is generally used together to represent the carriage return key on the keyboard. \ n can also be used only.
\ T indicates the "TAB" key on the keyboard.
Just like the difference between using enter and shift + enter, if you want to display the effect on the page, you need to convert it to HTML code or use...
Line feed characters in the file:
Linux, unix: \ r \ n
Windows: \ n
Mac OS: \ r
Corresponding:
\ N LF or 0x0A (10) in ASCII)
\ R CR or 0x0D (13) in ASCII)
\ T horizontal tab-0x09 (9) in HT or ASCII)
\ Backslash
\ $ Circle character
\ "Double quotation marks
\ 'Single quotes
Reasons for their origins and divergence:
The concepts of carriage return and line feed are different.
Before the computer appeared, there was a kind of device called Teletype Model 33, which can contain 10 characters per second. But there is a problem, that is, when a line breaks a line, it takes 0.2 seconds, just two characters. If a new character is passed in the 0.2 s, the character will be lost.
As a result, the developers thought of a way to solve this problem, that is, adding two end characters after each line. One is "enter", which tells the typewriter to position the print head on the left boundary, and the other is "line feed", which tells the typewriter to move the paper down one line.
This is the source of "line feed" and "Carriage Return". They can also be seen in their English names.
Later, computers were invented, and these two concepts were invented on computers. At that time, memory was very expensive. Some scientists thought it would be too waste to add two characters at the end of each line. Just add one character. As a result, there were differences.
In Unix systems, each line ends with only" <换行> ", That is," \ n "; in Windows, the end of each line is" <换行> <回车> ", That is," \ n \ r "; in Mac systems, the end of each line is" <回车> ". One direct consequence is that if a file in Unix/Mac is opened in Windows, all the text will be changed to a line; if a file in Windows is opened in Unix/Mac, A ^ M symbol may be added at the end of each line.
C language programming (windows)
\ R means return to the beginning of the row. This overwrites the previous output of this row.
For example:
The Code is as follows:
Int main (){
Cout <"hahaha" <"\ r" <"xixi ";
}
At last, only xixi is displayed, and hahaha is overwritten.
\ N is the carriage return + line feed. The cursor is first moved to the beginning of the line and then switched to the next line, that is, to pull the first line of the next line.
The Code is as follows:
Int main (){
Cout <"hahaha" <"\ n" <"xixi ";
}
Then:
Hahaha
Xixi