Common PHP Code, hash,split,unset
[Size=large]
) # return; #echo $line = preg_replace ("/\\n/", "", $line); #echo $line; $arr = Explode ("", $line); if (count ($arr) <2) continue; $query = $arr [0]; $ids = $arr [1]; $arrID = Explode ("", $ids); $len =count ($arrID); $str = ""; Unset ($hash); for ($i =0; $i < $len; $i + +) {$title =gettitle ($db, $arrID [$i]); $words = Explode ("", $title); foreach ($words as $word) {//echo $word; The judgment is not in the hash dictionary if (isset ($hash [$word])) {$hash [$word] = $hash [$word]+1; } else {$hash [$word] = 1; }}} $i = 0; Traversal hash Data structure foreach ($hash as $key = = $val) {if ($i ==0) {$str = $key. " \x03 ". $val; $i = 1; } else {$str = $str. " \x02 ". $key." \x03 ". $val; }}//String stitching echo "QF". $query. " \x01 ". $str." \ n ";} Fclose ($file _handle);? >[/size]