How can I get the first n characters of a string in PHP? What\'s the fastest way to trim a string to a specific number of characters, and append \'...\' if needed?
This is what i do
function cutat($num, $tt){ if (mb_strlen($tt)>$num){ $tt=mb_substr($tt,0,$num-2).'...'; } return $tt; }
where $num stands for number of chars, and $tt the string for manipulation.