Re: Fix for wordwrap()
| From: | Tom Sommer | Date: | Sun, 09 Mar 2003 00:01:11 +0000 |
| Subject: | Re: Fix for wordwrap() | ||
| References: | 1 2 3 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-94939@lists.php.net to get a copy of this message | ||
On Fri, 7 Mar 2003 08:20:19 +0100, Jedi/Sector One wrote:
> $a = "wwwwwwwwwwwwwwwwwwwwwwwww\nphprules\nwwwwwwwww";
> print wordwrap($a, 10, '<br />', 10);
> Output :
>
> wwwwwwwwww<br />wwwwwwwwww<br />wwwww
> phpr<br />ules
> wwwww<br />wwww
It's not....
it breaks with <br /> after 10 chars by force, because the cut argument is
set
why have you set cut to 10?
as the documentation states,
"If the cut is set to 1, the string is always wrapped at the specified
width. So if you have a word that is larger than the given width, it is
broken apart."
wordwrap is not broken...
It can be discussed if the cutcount (10) should be reset after a \n...
which would be logic?
PS. cut should had been a boolean, IMHO :)
--
Tom Sommer, denmark
www.tsn.dk - www.dreamcoder.dk