/ Published in: PHP

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/* 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='...'){ return ( $elli ) ? $new_string.'...' : $new_string; }
Comments
