PHP nl2br function converts newline characters into <br>_PHP tutorial

WBOY
Release: 2016-07-21 15:45:16
Original
1131 people have browsed it

Convert newline characters to
.
Syntax: string nl2br(string string);
Return value: String
Function type: Data processing
Content description
This function converts newline characters into HTML newline
instruction.

Copy code The code is as follows:

$str=' First line
No. Line 2
Line 3';
echo $str;// No replacement
echo("
-----------------< ;br>");
echo nl2br($str);// After replacement, display
?>

// Output
first line, second line, third line Line
-----------------
First line
Second line
Third line
nl2br
Convert newline characters into
.
PHP nl2br() syntax: string nl2br(string string);
Return value: string
Function type: data processing
PHP nl2br() content description
This function converts newline characters The
directive for HTML line breaks.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/320366.htmlTechArticleConvert newline characters to br. Syntax: string nl2br(string string); Return value: String Function type: Data processing Content description This function converts newline characters into HTML newline br...
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!