php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #14643 wordwrap() only for long words
Submitted: 2001-12-21 10:22 UTC Modified: 2003-02-06 21:16 UTC
From: pulstar at mail dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.6 OS: Linux
Private report: No CVE-ID: None
 [2001-12-21 10:22 UTC] pulstar at mail dot com
The function wordwrap() could work in another fashion, breaking only words bigger than the specified width instead of break all lines.

The web browsers always break text at spaces, fiting it in the web page. But if a somebody post a message with very long words (example: HEEEEEEEEEEEEEEEEEEEEEEEELLLLLLLLLLLLLOOOOOOOOOOOOOOOOOOOOOOOOOHOOOOWWWWWWWAREEEEEEEEEEEEEEEEEYOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOUUUUUUUUUUUUUUUUUUUUU????????????????????), it will stretch the page, showing the horizontal scrollbar and making a mess in the layout. 

With the actual wordwrap(), it will break all lines of text, so when I need to use the nl2br(), the text will appear as a small column in the left.

I need to use ns2br(), or the posts will appear "compacted".
So, if wordwrap() break only long words at specified width that will depend of my layout, everything will be fine. 

I think such behavior could work with a little differece in the cut parameter.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-06 21:16 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 03 06:01:31 2024 UTC