|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-06-19 10:55 UTC] bugs dot php dot net at jonatan dot com
Description:
------------
wordwrap() wraps incorrectly, wrapping too early in some
situations. As the example below shows, PHP wraps one of the
long lines ("Some text") at the maximum line length (9
characters in this case) and wraps the other one at a shorter
line length. Removing the first line from the test case
results in different but equally buggy wrapping.
I'm using Marc Liyanage's build of PHP, version 5.1.4 on an
Intel Mac.
Reproduce code:
---------------
<?php
$input =
'Some tex '.
'Some tex '.
'Some text '.
'Some tex '.
'Some text '.
'Some tex';
echo '<pre>'.wordwrap( $input, 9 )."</pre>\n";
?>
Expected result:
----------------
Some tex
Some tex
Some text
Some tex
Some text
Some tex
Actual result:
--------------
Some tex
Some tex
Some text
Some tex
Some
text
Some tex
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 18:00:02 2025 UTC |
$s = ' s '. ' t '; is equal to ' s t ' If you really want to get several text lines - you need to use "" and \n.