I'm trying to split a string after x characters and put it in array. But I need to don't cut word if x is in a middle of a word. What I expect is to split on the word inferior.
I Tried this :
CODE
$string = "Helllooooo I'mmm <strong>theeeeee</strong> <em> woooooorrd</em> theeee loooonnngessttt";
$desired_width = 24;
$str = wordwrap($string, $desired_width, "\n");
var_dump($str);
die;
OUTPUT
string 'Helllooooo I'mmm
<strong>theeeeee</strong>
<em> woooooorrd</em>
theeee loooonnngessttt' (length=86)
How to put it in array ? Is there another method to do that ? a mix between this and explode() ? thanks !