Guest User

Untitled

a guest
Jan 23rd, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. <?php
  2.  
  3. function ellipsis($string, $max = 20)
  4. {
  5. $string = html_entity_decode($string, ENT_QUOTES);
  6.  
  7. if (strlen($string) > $max)
  8. {
  9. $string = substr($string, 0, $max);
  10.  
  11. $pos = strrpos($string, ' ');
  12.  
  13. $string = rtrim(substr($string, 0, $pos));
  14. }
  15. return htmlentities($string).'&#8230;';
  16. }
  17.  
  18. ?>
Add Comment
Please, Sign In to add comment