Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function ellipsis($string, $max = 20)
- {
- $string = html_entity_decode($string, ENT_QUOTES);
- if (strlen($string) > $max)
- {
- $string = substr($string, 0, $max);
- $pos = strrpos($string, ' ');
- $string = rtrim(substr($string, 0, $pos));
- }
- return htmlentities($string).'…';
- }
- ?>
Add Comment
Please, Sign In to add comment