$length) { return rtrim(mb_substr($string, 0, $length, $encoding)) . $suffix; } return $string; } }