/*
returns text limited by a specified length of characters but keeping words intact. the final character count will not be exact since it is affected by the possible removing of the a long word or by the addition of the ellipsis.
paramaters:
string - the input string
chars - the length of characters wanted
elli - the ellipsis to be used, defaults to '...'
*/
function shorten($string='', $chars=20, $elli='...'){
list($new_string, $elli)= explode("\n", wordwrap($string, $chars, "\n", false));
return ( $elli ) ? $new_string.'...' : $new_string;
}