nl2br
Summary
Returns the input string with all newlines converted to HTML breaks.Usage
input|nl2br()
Returns
A string with HTML breaks.Description
This operator takes a string as input. It replaces newline characters/sequences with HTML break tags and returns a modified version of the input.
Examples
Example 1
{'The lazy cat jumps over the quick rat.'|nl2br()}
The following output will be produced:
The lazy<br />cat<br />jumps over<br />the quick rat.
Balazs Halasy (05/02/2004 10:57 am)
Julia Shymova (14/01/2008 1:06 pm)
Comments
NewLines left
Monday 19 November 2007 2:17:34 pm
Romain Petit
Can someone telle me please why in my case the nl2br operator (and the break operator) just place the "<br />" after the newline, and keep the newline present in the string ?
Exemple :
Grenland
består av fire
kommuner
gives me :
Grenland<br />
består av fire<br />
kommuner<br />
Thanks.