Posted By

ricosushi on 07/14/10


Tagged

text excerpt cuts


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

ricosushi


text excerpt


 / Published in: PHP
 

Returns a short string from a long string and adds "..." to the end of the string.

  1. function excerpt($texto,$n_chars){
  2.  
  3. return (strlen($texto)>$n_chars)?substr($texto,0,$n_chars)."...":$texto;
  4.  
  5. }

Report this snippet  

You need to login to post a comment.