Re: Word Wrapping
| From: | Gurhan Ozen | Date: | Sun, 25 May 2003 03:44:36 +0000 |
| Subject: | Re: Word Wrapping | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-148894@lists.php.net to get a copy of this message | ||
On Sat, 2003-05-24 at 22:37, Tom Ray [Lists] wrote:
> I'm fighting with wordwrap() and it appears I'm losing.
>
> Example:
>
> $text = "A very long, long, long line. This is a long long long line,
> very very very very very very long";
> $newtext = wordwrap($text, 20);
> print '"$text";
>
> It doesn't wrap anything. The output is still the same as in $text.
> Anyone know what I'm missing here. I've even tried
> $newtext = wordwrap($text, 20, "'\n", 1); and still nothing.
>
> TIA
>
Hi,
Ar you trying to display it on a webpage? If yes, you wouldn't see it
wrapped, because the newline character (\n) is not recognized by html..
After you wordwrap your string, put it through nl2br() function and
then you should see it wrapped -- \n will be replaced by <br />
Hope this helps..
Gurhan