The current functionality of the nl2br() function is to insert a <br /> tag before each newline in a string. (If the $is_xhtml parameter is set to false, <br> tags will be inserted instead of <br /> tags.) According to the documentation for version 2.8.7 of the Lynx browser, the correct method for inserting blank lines into an HTML document is to enclose a sequence of newlines between PRE tags. In addition, the Lynx browser may collapse a sequence of multiple BR tags into a single line break, depending on how the browser is configured. More details about this aspect of the Lynx browser are available at <http://lynx.isc.org/release/lynx2-8-7/ lynx_help/body.html#COLLAPSE_BR_TAGS> on the Web. The HTML 4.01 specification talks about the BR tag in section 9.3.2.1; details are available at <http://www.w3.org/TR/1999/REC-html401-19991224/struct/ text.html#h-9.3.2.1> on the Web. The specification states that "[t]he BR element forcibly breaks (ends) the current line of text," though it is not clear as to the situation where a "line of text" consists entirely of white space, or when two or more BR elements are separated by newlines.
The question is, should the nl2br() function be changed to enclose sequences of multiple newlines in PRE tags, as opposed to inserting a BR element before each newline? (For that matter, what exactly is the correct method for rendering multiple newlines for an HTML document?) As a possible alternative, would it be useful add a note about the issue of multiple newlines and HTML rendering by browsers to the documentation for the nl2br() function? --Richard