public static function getWords($words, $len)
    {
        $wordParts = explode(' ', $words);

        $sentence = '';

        for ($i = 0; $i < $len; $i++) {
            $sentence .= ' ' . $wordParts[$i];
        }

        return trim($sentence);
    }
public static function getWords($words, $len)
    {
        $wordParts = explode(' ', $words);

        $sentence = '';

        for ($i = 0; $i < $len; $i++) {
            $sentence .= ' ' . $wordParts[$i];
        }

        return trim($sentence);
    }
public static function getWords ( $ words , $ len ) { $ wordParts = explode ( ' ' , $ words ) ; $ sentence = '' ; for ( $ i = 0 ; $ i < $ len ; $ i ++ ) { $ sentence .= ' ' . $ wordParts [ $ i ] ; } return trim ( $ sentence ) ; }
Returns a determined number of words in a string.

@param string $words
@param int    $len

@return string
Returns a determined number of words in a string .