Split string into parts, only after whole word
Posted: Fri Sep 17, 2010 8:38 am
I have a really long string that I'm sending to a pdf document. When I send the string over to the pdf document, it doesn't get formatted very well so I was wondering if I could split the string into pieces.
Current I'm using:
This works for the most part however, it may split the string in the middle of word. Is there a way I can split the string after 100 or so words instead of characters?
Thanks
Current I'm using:
Code: Select all
$new_string = substr($string, 0, 100);
$new_string .= "\n" . substr($string, 100, 200);Thanks