
Texas |
Add the below function to your site
function string_limit_words($string, $word_limit) {
$words = explode(' ', $string);
return implode(' ', array_slice($words, 0, $word_limit));
}
Then you can set the values for the string and the word limit whenever you need to.
Eg.
echo string_limit_words($paragraph, 15);
So in the example above only the first fifteen words of the string $paragraph will be displayed.
Friday, 28th August 2009
| Votes: |
|
30 |
|
19 |
|