<?
echo "Begin Function=";
echo "<br>";
$text = "2lyve: this is: 8475978474957845 948594: jfhdhfkd: just the 2lyve: beginning:";
function getTrends($text)
{
$subject = $text;
$pattern ='/(\w+:)/Ui';
preg_match_all($pattern, $subject, $matches);
foreach($matches[1] as $value)
{
print $value."<br>";
}
}
getTrends($text);
?>
结果将是:
Begin Function=
2lyve:
is:
948594:
jfhdhfkd:
2lyve:
beginning:
如何计算每个结果返回的次数并对其进行排名?另外,如何将这些结果导入 sql 数据库?