/ Published in: PHP
Gets string and length and return string of given length. Makes sure half word in not in the end.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/* * stripText() * @action:get input string and returns splited string of given length * makes sure half word in not in the end * @parameters: * $str: string to be splited * $len: length of required string * @return: string of given length * @modified : 19 September 2010 * @modified by: Nilambar */ function stripText($str,$len=100) { $op=''; if($slen<=$len) { return $str; } else { $op.='...'; } return $op; }