Create a gist now

Instantly share code, notes, and snippets.

function texto($text, $limit=8) {
if (str_word_count($text, 0) > $limit) {
$words = str_word_count($text, 2);
$pos = array_keys($words);
$text = substr($text, 0, $pos[$limit]) . '...';
}
return $text;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment