Php code and (n or rn and br) app _ PHP Tutorial

Source: Internet
Author: User
Use line breaks and (n or rn and br) applications in php code. Code a: Copy the code as follows :? Phpechohellobr; echoworld !;? Output: hellloworld! Code B: Copy the code as follows :? Phpechohellon; unix system uses n; window 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 pipeline code is as follows :? Php echo 'hello/br '; echo 'World! ';? Output: helllo world! Code B: The code is as follows :? Php echo 'hello \ n'; // unix system \ n; window...

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.