Short Text, PHP
问题 I got this function: function shorter($text, $chars_limit) { if (strlen($text) > $chars_limit) return substr($text, 0, strrpos(substr($text, 0, $chars_limit), " ")).'...'; else return $text; } and if I use echo shorter($input, 11) it works ok, but if there are some white spaces in the input, otherwise for the input looking like: wwwwwwwwwww The function will change this into: ... (3 dots). I wan't it to be changed into something like this: www ... Have you got any ideas how to rebuild this