php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10707 nl2br gives <br /\n>
Submitted: 2001-05-07 11:27 UTC Modified: 2001-05-07 12:29 UTC
From: al at humantouch dot de Assigned:
Status: Closed Package: Strings related
PHP Version: 4.0.5 OS: RedHat 7.0
Private report: No CVE-ID: None
 [2001-05-07 11:27 UTC] al at humantouch dot de
It seems that nl2br() returns <br/\n>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-05-07 12:29 UTC] cardinal@php.net
What it's actually outputting is "<br />\n"

<? $str = "One\nTwo"; echo nl2br($str); ?>

Yields

One<br />
Two

This is consistent with its old behavior, which was to output "<br>\n"

While it might not strictly be the expected behavior, this seems fine to me.  The newline won't affect how a browser renders the string, since it's just whitespace to be ignored.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 01:01:28 2024 UTC