Chopping text
Posted: Sun Dec 24, 2006 5:11 pm
Merry Christmas everyone! Isn't it fun working on Christmas eve?
This will obviously chop text after a certain number of characters, without chopping in the middle of words. Now that I've moved to a WYSIWYG editor, html tags have been introduced. Anyone have any idea how to implement this so instead of now chopping in the middle of a word, to not chop until the closing tag is found.
Code: Select all
preg_match('#^\s*(.{'.$maxchop.',}?)\s+.*$#s', $article['body'], $match);