$str = explode(', ', $str);
$new_str = '';
$count_str = 0;
foreach ($str as $s) {
$count_str += mb_strlen($s, 'UTF-8') + 2;
if ($count_str < 20) {
$new_str .= $s.', ';
} else {
break;
}
}
substr($new_str, 0, -2);