November 16, 2016 —John Koster
The words
helper method is similar to the limit
function, but instead of limiting the number of characters returned, it limits the number of words returned.
The signature for the words
helper function is:
words($value, $words = 100, $end = '...')
1use Illuminate\Support\Str;2 3// Hello everyone...4echo Str::words('Hello everyone out there!', '2);
∎
The following amazing people help support this site and my open source projects ♥️
If you're interesting in supporting my work and want to show up on this list, check out my GitHub Sponsors Profile.