snippet_by_word_count

Text-related functions

Summary

snippet_by_word_count(string $text, integer $maxWords = 20, string $ellipsis = ...)

Return a substring of the text by limiting the word count.

Note: it strips the HTML tags from the text before getting the snippet

Parameters:
  • $text (string) –
  • $maxWords (integer) –
  • $ellipsis (string) –
Returns:

string

Usage

Examples

See Also