ejaboneta Posted November 29, 2010 Share Posted November 29, 2010 I'm trying to split up long text by words up to 1000 characters. What I mean is that I can't have a string be longer than 1000 characters. I know how to split up by 1000 characters, but then words get cut off at the end. So I figured I could preg_split it using something like this: $array = preg_split("/.{950,1000} /",$content); But that doesn't seem to work... Link to comment https://forums.phpfreaks.com/topic/220177-split-up-string-into-chunks-of-words-by-char-length/ Share on other sites More sharing options...
trq Posted November 30, 2010 Share Posted November 30, 2010 chunk_split Link to comment https://forums.phpfreaks.com/topic/220177-split-up-string-into-chunks-of-words-by-char-length/#findComment-1141228 Share on other sites More sharing options...
sasa Posted November 30, 2010 Share Posted November 30, 2010 you mean wordwrap() function Link to comment https://forums.phpfreaks.com/topic/220177-split-up-string-into-chunks-of-words-by-char-length/#findComment-1141325 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.