sloth456 Posted March 31, 2009 Share Posted March 31, 2009 say I have a large array of words e.g: apple,pear,orange,etc I would like to split the aray into smaller arrays every 500 characters, without actually splitting any words. Is there an easy way to do that. If you need me to explain again I'd be happy to. Link to comment https://forums.phpfreaks.com/topic/151924-split-array-by-number-of-characters/ Share on other sites More sharing options...
Brian W Posted March 31, 2009 Share Posted March 31, 2009 Possibly there is a better way, but you could use $block = wordwrap($string, 500);//500 characters long $array = explode("\n", $block);//break up the block on newlines Link to comment https://forums.phpfreaks.com/topic/151924-split-array-by-number-of-characters/#findComment-797776 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.