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 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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC