src/Util/Str.php
public static function shortenWords($input, $num_words = 35, $hellip = '&hellip;')
    {
        $words = explode(' ', $input);
        return (count($words) <= $num_words)
            ? join(' ', $words)
            : join(' ', array_slice($words, 0, $num_words)) . $hellip;
    }
public static function shortenWords($input, $num_words = 35, $hellip = '&hellip;')
    {
        $words = explode(' ', $input);
        return (count($words) <= $num_words)
            ? join(' ', $words)
            : join(' ', array_slice($words, 0, $num_words)) . $hellip;
    }
public static function shortenWords ( $ input , $ num_words = 35 , $ hellip = '&hellip;' ) { $ words = explode ( ' ' , $ input ) ; return ( count ( $ words ) <= $ num_words ) ? join ( ' ' , $ words ) : join ( ' ' , array_slice ( $ words , 0 , $ num_words ) ) . $ hellip ; }
Shorten a string
@param string $input
@param integer $num_words
@param string $hellip
@return string
Shorten a string