← All built-ins / nl2br()
nl2br()
nl2br(string $s): string
Parameters
| Name | Type | Description |
|---|---|---|
| $s | string | input string with newlines |
Return value
The string with "<br />" inserted before every newline (newlines kept).
Example
echo nl2br("line1\nline2"), "
";line1<br /> line2