$text = 'this is a long string that is over 28 characters long';
strlen($text) > 28 ? substr($text, 0, 28) .'...' : $text;
gives: this is a long string that i...
$text = 'this is a short string!';
echo strlen($text) > 28 ? substr($text, 0, 28) .'...' : $text;
gives: this is a short string!