Use this function to cutting text to a specific length, with the ability to prevent that the last word be cutted in half.
require 'cutText.php';
$text1 = 'Lorem ipsum dolor sit amet, sed do eiusmod tempor incididunt ut laboredo.';
// Normal usage:
printf('%s<br>', cutText($text1, 20));
// Using an space for break the string:
printf('%s<br>', cutText($text1, 20, ' '));