PHP » PYTHON |
login |
register |
about
|
def nl2br(string, is_xhtml= True ): if is_xhtml: return string.replace('\n','<br />\n') else : return string.replace('\n','<br>\n') nl2br(PHP 4, PHP 5) nl2br — Inserts HTML line breaks before all newlines in a string Description
string nl2br
( string $string
[, bool $is_xhtml= true
] )
Returns string with '<br />' or '<br>' inserted before all newlines. Parameters
Return ValuesReturns the altered string. Examples
Example #1 using nl2br()
<?phpThe above example will output: foo isn't<br /> bar
Example #2 Generating valid HTML markup using the is_xhtml parameter
<?phpThe above example will output: Welcome<br> This is my HTML document
Changelog
See Also
|
more
Recently updated
more
Most requested
|