Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

word count laravel arabic

function brief_text($string, $number_of_required_words = 50) {
        $string = trim(preg_replace('/s+/', ' ', $string));
        $words = explode(" ", $string);
        $required_words = array_slice($words, 0, $number_of_required_words); // get sepecific number of elements from the array
        return implode(" ", $required_words);
    }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #word #count #laravel #arabic
ADD COMMENT
Topic
Name
3+6 =