Error message is saying "The value of $start is greater than the length of $textlength". Add an "if" statement to bypass the function if $start is greater than the length of $textlength. +Put this code just before the mentioned line:
if (strlen($text) <= $maxlen) $maxlen = strlen($text);
and this should work. It will look probably like this:
function wrapText($text,$maxlen=120) {
if (strlen($text)>$maxlen) {
$text = strip_tags($text);
if (strlen($text) <= $maxlen) $maxlen = strlen($text);
$len = strpos($text," ",$maxlen);
if ($len) $text = substr($text,0,$len).' …';
}
return $text;
}
Cheers