ما حك جلدك مثل ظفرك
كود PHP:
function wordsonly ($text) {
//for the searching - strips out unneccessary bits
$text=strtolower($text);
$text=ereg_replace("<pre>[^<]*</pre>"," ",$text);
$text=ereg_replace("<[^>]*>"," ",$text); // remove HTML <> tags
$text=ereg_replace("&[^;];"," ",$text); // remove HTML special chars
// $text=ereg_replace("[^ 0-9a-z]"," ",$text); // keep only letters and numbers
$counter=0;
$words=explode(" ",$text);
while (list($key,$val)=each($words)) {
if (strlen($val)>2 and $val!="the" and $val!="this" and $val!="and" and $val!="but" and $val!="was" and $val!="that" and $val!="with" and $val!="its" and $val!="you" and $val!="they" and $val!="what" and $val!="why" and $val!="for" and $val!="are" and $val!="our" and $val!="then" and $val!="there" and $val!="which") {
$counter++;
$wordarray[]=$val;
}
}
if ($counter>0) {
return implode($wordarray," ");
}
}
وضعته للفائدة
والسلام عليكم