PHP-Fusion Development


Trim a text to a number of words.

Versions: 9

fusion_first_words( string $text, int $limit [, string $suffix ] ) : string


$text (string) (Required) String to trim.

$limit (int) (Required) The number of words.

$suffix (string) (Optional) If $text is longer than $limit, $suffix will be appended. Default value: …

Return Values

(string) String trimmed to the given length.


$text = 'The big brown fox jumped over the lazy dog';
echo fusion_first_words($text, 5);
// The big brown fox jumped…