[Solved] How to break the string after X letters? PHP


You are looking for this:

wordwrap($text, $x_num_of_letters, $string_to_break, true);

$x_num_of_letters should be an integer, of course.

If you need to go to the next line in rendered HTML for example inside a <p>, you need to use <br> as $string_to_break. If you mean the next line of the file, use \n or \n\r.

solved How to break the string after X letters? PHP