// usage: $var = char_chop($str(string), $string_length limit of chars, default: 30));
function char_chop($str, $string_length = 30) { $s = strlen($str); if($s > $string_length){ $str = substr(0, $string_length, $str); $str .= '...'; } return($str); }