The nl2br() function inserts HTML line breaks (
or
) in front of each newline (\n) in a string.
string nl2br ( string $string [, bool $is_xhtml = TRUE ] )
Returns string with
or
inserted before all newlines (\r\n, \n\r, \n and \r).
foo isn't<br /> bar
Welcome<br> This is my HTML document
This<br /> is<br /> a<br /> string<br />
Parameter | Description |
---|---|
string | The input string. |
is_xhtml | Whether to use XHTML compatible line breaks or not. |
Returns the altered string.