Home  >  Article  >  Backend Development  >  PHP nl2br function converts newline characters into <br>_PHP tutorial

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

WBOY
WBOYOriginal
2016-07-21 15:45:161111browse

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