function text_limit($str,$limit=10)
{
if(stripos($str," ")){
$ex_str = explode(" ",$str);
if(count($ex_str)>$limit){
for($i=0;$i<$limit;$i++){
$str_s.=$ex_str[$i]." ";
}
return $str_s;
}else{
return $str;
}
}else{
return $str;
}
}
echo text_limit('Gumeno Manyar Gresik',2);
script di atas akan menghasilkan:
Gumeno Manyar
Tuenkyu................. Ijin copas ya, makasih bgt, hehehe...
ReplyDelete