Re: Splitting a line of text

From: Date: Wed, 13 Sep 2000 22:44:07 +0000
Subject: Re: Splitting a line of text
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-16657@lists.php.net to get a copy of this message
Franklin van Velthuizen wrote: > > > Hi all. Is there any way that I can insert a new line (<br>\n) into a > string > > every 45 characters? > > take a look at > http://uk.php.net/manual/html/function.wordwrap.html > > $text = wordwrap($text, 45, "<br>\n") should do the trick, I guess Hi, I think wordwrap moves back to the first white space before the xth character. To put one exactly every 45 characters, you need something like: $text = ereg_replace("(.{45})", "\\1\n", $orig); Ciao, Andreas Pour http://www.kde.com/ : Everything KDE http://apps.kde.com/: The Latest in KDE Applications

« previous php.general (#16657) next »