code/Utilities.php
public static function getWordsWithinCharLimit($sentence, $limit = 150) {
        $str = '';
        $i = 1;

        if(strlen($sentence) < $limit) {
            return $sentence;
        }

        while (strlen($current = self::getWords($sentence, $i++)) < $limit) {
            $str = $current;
        }

        return $str;
    }
public static function getWordsWithinCharLimit($sentence, $limit = 150) {
        $str = '';
        $i = 1;

        if(strlen($sentence) < $limit) {
            return $sentence;
        }

        while (strlen($current = self::getWords($sentence, $i++)) < $limit) {
            $str = $current;
        }

        return $str;
    }
public static function getWordsWithinCharLimit ( $ sentence , $ limit = 150 ) { $ str = '' ; $ i = 1 ; if ( strlen ( $ sentence ) < $ limit ) { return $ sentence ; } while ( strlen ( $ current = self :: getWords ( $ sentence , $ i ++ ) ) < $ limit ) { $ str = $ current ; } return $ str ; }
Get max number of words within a character limit.
Get max number of words within a character limit .