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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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: Thu Aug 11 09:06:03 2022 UTC