Re: Word Wrapping

From: Date: Sun, 25 May 2003 02:20:56 +0000
Subject: Re: Word Wrapping
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-148892@lists.php.net to get a copy of this message
Are you outputting this stuff to to a browser? If so, remember that browsers ignore \n's when rendering. You need: $newtext = nl2br(wordwrap($text, 20, "\n", 1)); or: $newtext = wordwrap($test,20,'<br />\n', 1); Justin on 25/05/03 1:40 PM, Tom Ray [Lists] (lists@blazestudios.com) wrote: > It really is $newtext = wordwrap($text, 20, "\n", 1); > > In my frustration I double hit the key. > > 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 >> >> >

« previous php.general (#148892) next »