Use line breaks and (n or rn and br) applications in php code
Source: Internet
Author: User
The browser cannot recognize n or rn. The two linefeeds are text linefeeds, which are valid in the text file. if you need to output the results to the browser or print them to the monitor, use br in the code; if it is just a line break in the source code, use n or rn. if you are interested, you can find out, maybe you have code:
The code is as follows:
Echo 'hello
';
Echo 'World! ';
?>
Output:
Helllo
World!
Code B:
The code is as follows:
Echo 'hello \ n'; // \ n for unix systems; \ r \ n for windows systems
Echo 'World! ';
?>
Output:
Helloworld!
Analysis: The browser cannot recognize \ n or \ r \ n. the two line breaks are text line breaks, which are valid for text files. you can check the HTML source code on the webpage and find that code B successfully implements line breaks.
Summary: If you need to output the result to a browser or print it to the monitor, use
Use \ n or \ r \ n if it is just a line break in the source code.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.