ID: 37846
User updated by: bugs dot php dot net at jonatan dot com
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:
I only reopen the bug because your responses keep failing to
address my comments. As with the majority of your previous
comments, your last comment implies to me that you either
haven't read, have misunderstood or have understood but
choose not to respond to my latest comment.
You think counting characters that don't exist is logical?
And you will not consider adding the note to the
documentation?
I will only reopen this bug if you fail to answer these
questions.
Previous Comments:
------------------------------------------------------------------------
[2006-06-21 07:39:53] [EMAIL PROTECTED]
There is nothing to discuss.
bjori and me already explained you every bit of your code.
Please STOP reopening this BOGUS report.
Thank you.
------------------------------------------------------------------------
[2006-06-20 21:47:02] bugs dot php dot net at jonatan dot com
Unbogusing again, as per my previous comment.
(As for needing to explain to me how to count from 1 to 9,
apparently you do. I was under the assumption that one should
always start at 1...)
------------------------------------------------------------------------
[2006-06-20 14:39:10] bugs dot php dot net at jonatan dot com
Sorry for my tone earlier. It didn't seem like anyone
understood my bug report.
It is only the tenth character if you count the leading
space, which doesn't exist, because it has been trimmed.
Your explanation would make sense if wordwrap() didn't trim
leading (or trailing) spaces from wrapped lines; resulting
in something like:
Some tex
Some tex
Some text
Some tex
Some
text
Some tex
(note leading and trailing space on lines)
But that's not what wordwrap() returns. The fact that (I'm
guessing) the trimming internally occurs after the counting
is merely an implementation detail of wordwrap() that
shouldn't be exposed outside the function.
I'd suggest fixing wordwrap() to wrap more efficiently.
Given the trimming of spaces, that can hardly be considered
to be incorrect.
Either that, or adding the following note to the
documentation:
Note that if a line happens to be exactly as long as the
maximum line length, the following line will be considered
to start with a leading space, even though it does not do
so, for porposes of calculating the maximum amount of text
that can fit on that line.
------------------------------------------------------------------------
[2006-06-20 14:00:58] [EMAIL PROTECTED]
<?php
// 'Some tex Some tex Some text Some tex Some text Some
tex';
$foo = "1234 678 1234 678 1234 6789 2345 789 2345 7890 2345
678";
print wordwrap($foo, 9) . "\n";
?>
1234 678
1234 678
1234 6789
2345 789
2345
7890
2345 678
The latter "t" in "text" is the TENTH character.
Now PLEASE leave this report as bogus.
------------------------------------------------------------------------
[2006-06-20 14:00:30] [EMAIL PROTECTED]
Oh, god..
Here is what wordwrap() does:
"Some tex|Some tex|Some text| Some tex| Some tex|t Some tex"
Write it down on paper and count symbols yourself.
Is everything clear for you this time? Or do I need to explain how to
count from 1 to 9?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/37846
--
Edit this bug report at http://bugs.php.net/?id=37846&edit=1