Home >Backend Development >PHP Tutorial >PHP space, newline, tab usage instructions_PHP tutorial

PHP space, newline, tab usage instructions_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:41:401409browse

First, let’s talk about n, r, t

n Soft return:
In Windows, it means a line break and returns to the beginning of the next line.
In Linux and Unix, it only means a line break, but not will 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)

A few notes:

They are valid in strings represented by double quotes or delimiters, and in strings represented by single quotes Invalid.
rn is generally used together to represent the Enter key on the keyboard (in Linux and Unix). You can also just use n (in Windows). In Mac OS, use r to represent Enter!
t represents the "TAB" key on the keyboard.

Newline symbol in file:

windows: n
linux,unix: rn
Mac OS:

Copy code The code is as follows:

$dir = "E:/PHPworkspace";
if($handle = opendir($dir)){
echo "The directory path is: $dir /n";
echo "Files included: /n";
}
//This is the correct way to traverse the directory
while (false !== ($file=readdir($handle))) {
echo "$file/n";
}
?>

Copy code The code is as follows:

$dir = "E:/PHPworkspace";
if($handle = opendir ($dir)){
echo "The directory path is: $dir /n";
echo "Contained files: /n";
}
//This is the correct way to traverse the directory Method
while (false !== ($file=readdir($handle))) {
echo "$file/n";
}
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/321101.htmlTechArticleFirst let’s talk about n, r, t n soft carriage return: In Windows, it means a line break and returns to the end of the next line. The starting position in Linux and Unix only represents a line break, but does not return to the starting position of the next line. ...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn