snippet

Text-related functions

Summary

snippet(string $text, int $startPos, int $endPos, string $append = …)

Return a substring of a given piece of text.

Note: this will only split strings on the space character.this will also strip html tags from the text before getting a snippet

Parameters:
  • $text (string) – Text to take snippet of
  • $startPos (int) – Starting position of snippet in string
  • $endPos (int) – Maximum length of snippet
  • $append (string) – String to append to snippet if truncated
Returns:

string Snippet of given text

Usage

Examples

See Also

Project Versions

Table Of Contents

Previous topic

html_escape

Next topic

snippet_by_word_count

This Page