nl2br
PHP 4, PHP 5, PHP 7, PHP 8
nl2br - Inserts HTML line breaks before all newlines in a string
nl2br(
string$string,
[bool$use_xhtml = true] ): string
Returns string with <br />
or
<br>
inserted before all newlines (\r\n,
\n\r, \n and \r).
Parameters
- string
-
The input string.
- use_xhtml
-
Whether to use XHTML compatible line breaks or not.
Return Values
Returns the altered string.