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);
}