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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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: Mon Dec 02 23:01:29 2024 UTC