php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16134 wordwrap() with \n
Submitted: 2002-03-18 03:20 UTC Modified: 2002-06-01 13:11 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: junk at singles dot de Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: 4.1.0 OS: every
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: junk at singles dot de
New email:
PHP Version: OS:

 

 [2002-03-18 03:20 UTC] junk at singles dot de
Code: echo wordwrap("ab cd\nef gh ij kl",5);

Output:
ab
cd
ef gh
ij kl

Expected output:
ab cd
ef gh
ij kl

---------
Code: echo wordwrap("ab cd\nef gh ij kl",5,"\n",1);

Output:
ab
cd
ef gh
ij
kl

Expected Output:
ab cd
ef gh
ij kl

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-03 09:23 UTC] martin at humany dot com
php 4.2.0 handles this as you expected, and respects the optional parameter which you specify what you want to use as separator, for example

echo wordwrap(nl2br($text), 10, "<br />",1);

respects the "<br />" inserted by nl2br in the text.

echo wordwrap(nl2br($text), 10, "<br>",1);
does not since "<br />" != "<br>" :)
 [2002-06-01 13:11 UTC] edink@php.net
So the issue is resolved then.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun Jul 03 19:04:05 2022 UTC