0){ $start = $position - 30; if($start < 0) $start = 0; $last = $start + $end; $artm[$i][0] += $artm[$i-1][1] + $start; $artm[$i][1] = $artm[$i][0] + $end; $cutone = substr($prnt, $start, $end); $prnt = substr($prnt, $last); $position = strpos($prnt, "[$needle]"); $arkCnt = substr_count($prnt, "[$needle]"); $bufStart = $start; $bufLast = $last; $i++; } /////////////////////////////////////////////////////////// // tidak benarkan function ini papar lebih dari // 3 keratan data untuk setiap $needle /////////////////////////////////////////////////////////// if(count($artm)>3){ $choose = 3; }else{ $choose = count($artm); } /////////////////////////////////////////////////////////// // akhir sekali, paparkan output /////////////////////////////////////////////////////////// for($j=0; $j<$choose; $j++){ if($j==0) echo " ... "; $stt = $artm[$j][0]; $cutone = substr($newstack, $stt,$end); $output = eregi_replace ("[^[:alnum:]]{1,2}($needle)[^[:alnum:]]"," $needle ",$cutone); echo $output." ... "; } } // end function ?>