php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13362 function wordwrap bug
Submitted: 2001-09-18 07:33 UTC Modified: 2002-01-04 14:41 UTC
From: herveseignole at yahoo dot fr Assigned:
Status: Not a bug Package: Strings related
PHP Version: 4.0.4pl1 OS: Linux Mandrake 8.0
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: herveseignole at yahoo dot fr
New email:
PHP Version: OS:

 

 [2001-09-18 07:33 UTC] herveseignole at yahoo dot fr
<?
$text="A very long woooooooooooord.";
$newtext=wordwrap($text,8," ",1);
echo "$newtext\n";
?>
return:
 
A very long woooooooooooo rd.
 
not
A very long wooooooo ooooord.
 
php 4.0.4pl1

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-20 22:25 UTC] sniper@php.net
Reproduced with PHP 4.1.0RC1

 [2001-10-21 05:06 UTC] derick@php.net
4.2.0dev shows:
A very long woooooooooooor d.
 [2002-01-04 14:40 UTC] jimw@php.net
this current behavior is correct. wordwrap() will only cut a word when it is, by itself, longer than the line length. whenever it can cut the line between words, it does.

it is easier to see what is going on using:

<?
$text="A very long woooooooooooord.";
echo wordwrap($text, 8, "|", 1);

which prints:

A very|long|wooooooo|ooooord.
 [2002-01-04 14:41 UTC] jimw@php.net
oops, meant to flag as bogus, since this is not a bug.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Sep 19 04:01:27 2019 UTC