When I think about it, why Should I use the function nl2br() instead of using the tags <pre></pre>
?
Thanks.
When I think about it, why Should I use the function nl2br() instead of using the tags <pre></pre>
?
Thanks.
It's upto you and your desired output. There is no Should
and <pre>
is not just for new lines, nl2br()
is limited to that.
The pre element represents a block of preformatted text, in which structure is represented by typographic conventions rather than by elements.
nl2br — Inserts HTML line breaks before all newlines in a string
Spot and prioritize the difference yourself :)