advanced code snippet search
jmiller on 02/23/10
trim String length cut elipses
02/23/10 03:28pm
1 person have marked this snippet as a favorite
dantreacy
// Trims a string down to a certain length and inserts an ellipses if it was trimmed.function cut($str, $len=30) { if (strlen($str) > $len) { return substr($str, 0, $len-2) . '…'; } else { return $str; }}
Report this snippet Tweet
Comment:
You need to login to post a comment.