How do you cut off text after a certain amount of characters in PHP?
May I make a modification to pallan's code?
$truncated = (strlen($string) > 20) ? substr($string, 0, 20) . '...' : $string;
This doesn't add the '...' if it is shorter.
Really quickly,
$truncated = substr('12345678901234567890abcdefg', 0, 20) . '...'