Name
nl2br()
Synopsis
string nl2br ( string str
)
The nl2br
function inserts a HTML line break (<b
r />
) before all new line characters. You should note that it does not replace the line breaksâthe \n breaks are left intact. For example:
$mystr = "This is a test\nYes it is."; $brstr = nl2br($mystr); // set to "This is a test<br />\nYes it is."
Get PHP in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.