Home >Backend Development >PHP Tutorial >Application of line breaks and (n or rn and br) in PHP code_PHP tutorial

Application of line breaks and (n or rn and br) in PHP code_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:13:31785browse

Code a:

Copy code The code is as follows:

echo'hello
' ;
echo 'world!';
?>

output:
helllo
world!
Code b:
Copy code The code is as follows:

echo'hellon';//Use n in unix system; rn in windows system
echo'world!';
?>

output:
helloworld!
Analysis: The browser cannot recognize n or rn, these two The newline character is a text newline character, and the text file is valid; viewing the HTML source code in the web page, you can find that code b successfully implements newline
Summary: If you need to output the results to the browser or print to the monitor, Use
in the code; If you just want to wrap the line in the source code, use n or rn

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/326495.htmlTechArticleCode a: Copy the code as follows: ?php echo'hello/br'; echo'world!'; ? output: helllo world! Code b: Copy the code as follows: ?php echo'hellon'; //Unix system uses n; window...
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