note 17617 added to function.split

From: Date: Mon, 17 Dec 2001 12:39:35 +0000
Subject: note 17617 added to function.split
Groups: php.notes 
Request: Send a blank email to php-notes+get-22981@lists.php.net to get a copy of this message
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 -- http://www.php.net/manual/en/function.split.php http://master.php.net/manage/user-notes.php?action=edit+17617 http://master.php.net/manage/user-notes.php?action=delete+17617 http://master.php.net/manage/user-notes.php?action=reject+17617

« previous php.notes (#22981) next »