I have the following string in a variable.
Stack Overflow is as frictionless and painless to use as we could make it.
I want to fetch first 28 characte
You can use the wordwrap() function, then explode on newline and take the first part:
$str = wordwrap($str, 28); $str = explode("\n", $str); $str = $str[0] . '...';