-2

When I think about it, why Should I use the function nl2br() instead of using the tags <pre></pre> ?

Thanks.

UltraInstinct
  • 43,308
  • 12
  • 81
  • 104
Eliya Cohen
  • 10,716
  • 13
  • 59
  • 116

1 Answers1

4

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.

Source

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

Source

Spot and prioritize the difference yourself :)

Hanky Panky
  • 46,730
  • 8
  • 72
  • 95