i am using substr to trim the first 100 characters from the string. however i need a function that can trim a particular number of words, instead of characters from a string?
$trimmed_details = substr($row->details, 0, 200).'...';
is there a built in function to do that?
Try this: