php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #54611 one functionality is left out
Submitted: 2011-04-27 06:43 UTC Modified: 2011-04-27 10:45 UTC
From: neptronix at gmail dot com Assigned: bjori (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: linux
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: neptronix at gmail dot com
New email:
PHP Version: OS:

 

 [2011-04-27 06:43 UTC] neptronix at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.nl2br#Examples
---

NL 2 BR can also be used to insert < BR > tags when a string contains return 
characters other than \n.

Spent many hours on google trying to find out a PHP command that could do this.. 
but the functionality wasn't mentioned in this doc!!

For example, this string:

"this is a bunch
of text in a string
from mysql"

can come out with < BR > tags in it with nl2br.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-04-27 10:08 UTC] bjori@php.net
-Status: Open +Status: Feedback
 [2011-04-27 10:08 UTC] bjori@php.net
I don't get it. Isn't that exactly what the example shows?
 [2011-04-27 10:15 UTC] neptronix at gmail dot com
-Status: Feedback +Status: Open
 [2011-04-27 10:15 UTC] neptronix at gmail dot com
Nope, it only mentions that 'newlines' will be converted to < BR >, which i assume 
are the \n character...

When you stick an ordinary return carrier in the text string, it converts that to 
a < BR > also.. no mention there.. ! not even in the comments from users below.

I am a new PHP programmer, i hope this functionality isn't an undocumented fluke 
because i couldn't think of any other way to do it..
 [2011-04-27 10:37 UTC] bjori@php.net
The function replaces "\r\n", "\n" and "\r".
I suppose we could have an explicit example for it...
 [2011-04-27 10:45 UTC] bjori@php.net
Automatic comment from SVN on behalf of bjori
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=310543
Log: Fixed bug#54611 one functionality is left out
 [2011-04-27 10:45 UTC] bjori@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: bjori
 [2011-04-27 10:45 UTC] bjori@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 18:00:02 2026 UTC