Have a Snippet?

Keep, track and share your code snippets with your friends

PHP: Limit Words in a String Share on Vkontakte

If you wanted to do this effect quickly, you could just use the function substr(). However, the substr() function only limits the number of characters being displayed. The returned result would be an excerpt of text that may or may not have the ending word cut-off.

Tag: PHP, limit, words;