Revision: 35496
Updated Code
at November 9, 2010 13:46 by resting
Updated Code
function limit_words($string, $word_limit) { $append = ''; $words = explode(" ",$string); if(count($words) > $word_limit) { $append = '...'; } return implode(" ",array_splice($words,0,$word_limit)) . $append; }
Revision: 35495
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 9, 2010 13:43 by resting
Initial Code
function limit_words($string, $word_limit) { $append = ''; $words = explode(" ",$string); if(count($words)) > $word_limit) { $append = '...'; } return implode(" ",array_splice($words,0,$word_limit)) . $append; }
Initial URL
Initial Description
modification to [http://snipplr.com/view/12987/limit-words-in-a-string/](http://snipplr.com/view/12987/limit-words-in-a-string/) Appends ... if string is truncated.
Initial Title
Modified Word limit function
Initial Tags
Initial Language
PHP