Home > Backend Development > PHP Tutorial > In-depth explanation of PHP nl2br() formatted output_PHP tutorial

In-depth explanation of PHP nl2br() formatted output_PHP tutorial

WBOY
Release: 2016-07-21 15:09:28
Original
951 people have browsed it

The nl2br() function can convert the newline characters in the string into HTML newline symbols

Copy the code The code is as follows:

$str = "It has been raining in the past few days. I am very sad
. I can’t hit the ball and my shoes are soaked.";
echo $str;
echo "
";
echo nl2br($str);
?>

Output result:
Copy code The code is as follows:

It has been raining in the past few days. I am so sad. I can’t hit the ball and my shoes are soaked.
It has been raining in the past few days. I am very sad. I cannot hit the ball and my shoes are soaked.

Attachment: Discuss in depth what is the difference between "
" and "rn"??

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327303.htmlTechArticlenl2br() function can convert the newline characters in the string into HTML newline symbols. Copy the code as follows: ? php $str = "It has been raining in the past few days. I am so sad. I can’t hit the ball and my shoes are wet...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template