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...