1
<?
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);
?>
结果将是:Preg_match_all计数器?
Begin Function=
2lyve:
is:
948594:
jfhdhfkd:
2lyve:
beginning:
如何指望有多少次返回每个结果和排名吗?另外,如何将这些结果导入到sql数据库中?
感谢。我也调整了一下,打印出一个干净的格式,但我仍然试图按发生次数对它们进行排名 – ImJeaniusDoe 2013-03-26 16:15:49