PHP to limit a text string to a number of words
Recently I had cause to show an excerpt of information which would then link to another page for the complete article. I had to show a limited number of words from the entire article as a teaser. I managed to do this with a little function. function limit_words($string, $word_limit) { $words = explode(" ",$string); [...]