Revision: 32472
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 26, 2010 01:35 by nilambar
Initial Code
/* * 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) { $str=trim($str); $str=strip_tags($str); $slen=strlen($str); $op=''; if($slen<=$len) { return $str; } else { $str=substr($str,0,$len); $exploded_array=explode(' ',$str ); $wordcount=count($exploded_array); $last=array_pop($exploded_array); $op=implode(' ',$exploded_array); $op.='...'; } return $op; }
Initial URL
Initial Description
Gets string and length and return string of given length. Makes sure half word in not in the end.
Initial Title
Strip Text of given length
Initial Tags
php
Initial Language
PHP