PHP whitespace newline TAB use instructions

  • 2020-03-31 20:04:25
  • OfStack

First,\ n,\r,\t

\n soft return:
Represents a line break in Windows and returns to the beginning of the next line
In Linux, Unix, it only represents a new line, but it does not return to the beginning of the next line.
\r soft space:
Represents a return to the beginning of the line in Linux and Unix.
Represents a newline in Mac OS and returns to the beginning of the next line, which is equivalent to the effect of \n in Windows.
\t skip (move to next column)

Some notes:

They are valid in strings represented by double quotes or delimiters and not in strings represented by single quotes.
\r\n is commonly used together to indicate the return key on the keyboard (Linux,Unix), or just \n(Windwos), and \r for the Mac OS!
\t represents the "TAB" key on the keyboard.

Newline symbol in the file:

Windows: \ n
Linux, Unix: \ r \ n
Mac OS: \
 
<?php 
$dir = "E:/PHPworkspace"; 
if($handle = opendir($dir)){ 
    echo " Directory path is : $dir /n"; 
    echo " Included files : /n"; 
} 
//This is the correct way to traverse the directory
while (false !== ($file=readdir($handle))) { 
    echo "$file/n"; 
} 
?> 

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

Related articles: