I\'m pulling blog posts from a DB. I want to trim the text to a max length of 340 characters.
If the blog post is over 340 characters I want to trim the text to the las
try:
preg_match('/^.{0,340}(?:.*?)\b/siu', $text, $matches); echo $matches[0] . '...';