(PHP 3, PHP 4 )

nl2br --  Inserts HTML line breaks before all newlines in a string


string nl2br ( string string)

Returns string with '<br />' inserted before all newlines.

注: Starting with PHP 4.0.5, nl2br() is now XHTML compliant. All versions before 4.0.5 will return string with '<br>' inserted before newlines instead of '<br />'.

例子 1. using nl2br()

echo nl2br("foo isn't\n bar");

this will output :

foo isn't<br />

See also htmlspecialchars(), htmlentities(), wordwrap(), and str_replace().

虎的笑话 虎的成语 虎的歇后语