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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: al at humantouch dot de
New email:
PHP Version: OS:

 

 [2001-05-07 11:27 UTC] al at humantouch dot de
It seems that nl2br() returns <br/\n>

Patches

Pull Requests

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: Sat Dec 21 15:01:29 2024 UTC