title: Break a string into multiple lines
body: <p>I need to split a sentence/string into small chunks based on a particular string length. PHP's str_split function is doing half of the work; I need to retain a full word. In other words, I do not want a word to be separated abruptly into two at the end of each line. I cannot figure out the solution. It will be of great help if you suggest me something.   </p>
  
  <p>Here is the code and the result so far.</p>
  
  <pre><code>$line = "After six months, participants in both vitamin D supplementation groups had lost more weight and had greater reductions in their waistlines than those who hadn't taken the supplements, Vigna's team said";
  $chunks = str_split($line, 35);
  echo '&lt;pre&gt;' . print_r($chunks, true);
  
  
  
  
  Array
  (
      [0] =&gt; After six months, participants in b
      [1] =&gt; oth vitamin D supplementation group
      [2] =&gt; s had lost more weight and had grea
      [3] =&gt; ter reductions in their waistlines 
      [4] =&gt; than those who hadn't taken the sup
      [5] =&gt; plements, Vigna's team said
  )
  </code></pre>