You can use the wordwrap() function then explode on newline and take the first part, if you don't want to split words.
$str = 'Stack Overflow is as frictionless and painless to use as we could make it.';
$str = wordwrap($str, 28);
$str = explode("\n", $str);
$str = $str[0] . '...';
Do a little homework with the php online manual's string functions.
You'll want to use strlen in a comparison setting, substr to cut it if you need to, and the concatenation operator with "..." or "…"
2nd argument is where to start string and 3rd argument how many characters you need to show
$title = "This is for testing string for get limit of string This is for testing string for get limit of string This is for testing string for get limit of string This is for testing string for get limit of string";
echo substr($title,0,50);
It's been a while since I wrote this answer and I don't actually use this code any more. I prefer this function which prevents breaking the string in the middle of a word using the wordwrap function: