php The nl2br function means to insert an HTML newline mark before all new lines in the string. Its syntax is nl2br(string,xhtml). The parameter string is required and specifies the string to be checked, while xhtml is optional.
#How to use the nl2br function?
Function: Insert a newline character before a new line (\n) in the string.
Syntax:
nl2br(string,xhtml)
Parameters:
string Required. Specifies the string to check.
xhtml Optional. Boolean indicating whether to use XHTML-compatible line breaks: TRUE - Default. INSERT
FALSE - INSERT
Description: Insert an HTML newline character (
or
).
php nl2br() function usage example:
<?php echo nl2br("First line.\nSecond line.",false); ?>
Output:
First line. Second line.
This article is an introduction to the PHP nl2br function. I hope it will help you if you need Friends help!
The above is the detailed content of How to use php nl2br function. For more information, please follow other related articles on the PHP Chinese website!