title: How to cut a text after a number of chars and obtain text sporead on multiple rows?
body: <p>I have a very long text, and I need to cut the text after N chars, so that at the end I obtain a text, rendered on multiple rows, without any of the words being cut;</p>
  
  <p>So, if a have a text with the lenght of a 1000 chars, which has been saved on 1 line, and I need to cut from 100 to 100 chars, at the end, I will get a text spread on 10 lines.</p>
  
  <p>I tryed something, but I got stuck;</p>
  
  <p>foreach does not work, the text is not seen a a array; also, i did not made sure to keep the words intact in my test;</p>
  
  <p>Has anyone tryed this? Or is there any link with solution?</p>
  
  <pre><code>public static function cut_line_after_n_chars($str, $n = 70) {
      $result = '';
      $pos = 0;
      foreach ($str as $c) {
          $pos++;
          if ($pos == $n) {
              $result .= $c + '&lt;br/&gt;';
              $pos = 0;
          }
          else
              $result .= $c;
      }
      return $result;
  }
  </code></pre>