PHP line break

Source: Internet
Author: User

/**************** By Jiangong sun ******************* ***/

\ T horizontal Tab

\ ", \ ', \ Special characters

\ N is a line feed, linefeed in English, and 0xa in ASCII code
\ R is the carriage return, carriage return in English, and ASCII code is 0xd

 

The difference between carriage return and line feed:

\ N, \ r are both ASCII codes

\ N is to move the cursor to the next line, and the horizontal position remains unchanged.

\ R press enter to move the cursor to the beginning of the line.

 

If you have used a mechanical typewriter, you will know the difference between carriage return and line feed.
WRAP is to roll the drum to one grid without changing the horizontal position.
Press enter to reset the horizontal position without rolling the drum.

 

In Windows, the carriage return line break is \ r \ n.

In Linux, the carriage return line break is \ n because \ r does not exist.

The Mac carriage return line is \ r.

 

 

<PRE> a common application of tags is to represent the source code of a computer.

Pre elements can define pre-formatted text. Text enclosed in the PRE element usually contains spaces and line breaks. The text is also displayed as an equal-width font.

 

Nl2br is used to convert/N to <br>

 

<? PHP
Echo "<PRE> Hello \ nworld </PRE> ";
Echo "<br/> ";
Echo nl2br ("Hello \ rword2 ");
Echo "<br/> ";
Echo "Hello \ tword3 ";
Echo "<br/> ";
Echo "Hello \ world4 ";
Echo "<br/> ";
Echo "This spans \ nmultiple lines. The newlines will be \ noutput as well .";
Echo "<br/> ";
?>

Related Article

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.