Re: note 17617 added to function.split

From: Date: Mon, 17 Dec 2001 19:27:49 +0000
Subject: Re: note 17617 added to function.split
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-22997@lists.php.net to get a copy of this message
On December 17, 2001 05:39 am, klein@webprojects.de wrote: > I needed a function that would split the text at a given length: > > $cutlen = 150 //cut after $cutlen chars > $len = strlen($text); // get $text length > > while($len > $cutlen) { > $array[] = substr($text,0,$cutlen); > $text = substr($text,$cutlen); > $len = strlen($text); > } > > $array[] contains the lines after the text has been processed. > Maybe $text has to be handled afterwards tho See wordwrap() -- Zak Greant PHP Quality Assurance Team http://qa.php.net/ "We must be the change we wish to see." - M. K. Ghandi

« previous php.notes (#22997) next »