Home >Backend Development >PHP Tutorial >Example introduction to the difference between r rn t in php_PHP tutorial
n Soft return:
means a line break in Windows and returns to the beginning of the next line. Equivalent to the effect of r in Mac OS.
In Linux and Unix, it only means line break, but it will not return to the beginning of the next line.
r Soft space:
in Linux and unix means returning to the beginning of the current line.
In Mac OS, it means wrapping and returning to the beginning of the next line, which is equivalent to the effect of n in Windows.
t Tab (move to next column).
They are valid in strings represented by double quotes or delimiters, but not in strings represented by single quotes.
rn is generally used together to represent the Enter key on the keyboard, or just n can be used.
t represents 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 into HTML code or use...
Newline symbol in the file:
linux, unix: rn
windows: n
Mac OS: r
corresponds to:
n LF or 0x0A(10) in ASCII
r 0x0D(13) in CR or ASCII
t Horizontal tab - 0x09 (9) in HT or ASCII
\ backslash
$ dollar sign
" double quote
' Single quotation marks
about their origins and cause differences:
The origins and differences between the two concepts of "carriage return" and "line feed" .
Before the advent of computers, there was a thing called the Teletype Model 33, which could type 10 characters per second. But it had a problem, which was that it had to use a new line after typing. If you go to 0.2 seconds, you can type two characters. If a new character is transmitted during this 0.2 seconds, the character will be lost
So, the developers thought of a way to solve this problem. Just add two characters to indicate the end of each line. One is called "carriage return", which tells the typewriter to position the print head at the left border; the other is called "line feed", which tells the typewriter to move the paper down one line. 🎜>This is the origin of "line feed" and "carriage return", which can be seen from their English names
Later, the computer was invented, and these two concepts were introduced to computers. At that time, memory was very expensive, and some scientists thought it was too wasteful to add two characters at the end of each line. So, there was a disagreement. In Unix systems, only one character was added at the end of each line. "
When programming in C language (windows system)
r is return. Returning to the beginning of this line will overwrite the previous output of this line
For example:
Copy code
www.bkjia.com