function substr_words ($paragraph, $num_words) {
$paragraph = explode (' ', $paragraph);
$paragraph = array_slice ($paragraph, 0, $num_words);
return implode (' ', $paragraph);
}

Advertisements