ID: 37846 Updated by: [EMAIL PROTECTED] Reported By: bugs dot php dot net at jonatan dot com Status: Bogus Bug Type: Strings related Operating System: Mac OS X 10.4.6 PHP Version: 5.1.4 New Comment:
"wordwrap() - Returns a string with str wrapped ****AT**** the column number specified by the optional width parameter." "Some text" <- the last "t" is symbol #9, so whole "text" word is wrapped (since you didn't pass third argument). Previous Comments: ------------------------------------------------------------------------ [2006-06-19 15:14:13] bugs dot php dot net at jonatan dot com No, I think you're the only one who is confused. ;-) I'm pretty sure this is a bug. The problem is that PHP only cuts some of the lines (the third in my example) at position 9, and incorrectly cuts some lines (the fifth in my example) at position 8. ------------------------------------------------------------------------ [2006-06-19 13:33:00] [EMAIL PROTECTED] Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. You may be confused with your "virtual" lines (as I was as well :). worwrap does wrap at the pos. 9 and this is what it does. Word are not cuted. ------------------------------------------------------------------------ [2006-06-19 13:09:57] [EMAIL PROTECTED] reproducible in dev branches (5.2 and head), on other OS/platform than OSX as well. ------------------------------------------------------------------------ [2006-06-19 10:55:33] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37846&edit=1