我正在尝试在强标签中搜索关键字。
我为标签生成了一个数组,显示为:
Array
(
[0] => Array
(
[0] => seo agency in london
[1] => seo agency in london
[2] => seo consultant in london
[3] => seo consultant in london
[4] => seo experts in london
)
[1] => Array
(
[0] => seo agency in london
[1] => seo agency in london
[2] => seo consultant in london
[3] => seo consultant in london
[4] => seo experts in london
)
)
我想搜索在这种情况下是“seo”的关键字
我在用:
function substr_count_array( $haystack, $needle ) {
$count = 0;
foreach ($needle as $substring) {
$count += substr_count( $haystack, $substring);
}
return $count;
}
$matchPattern7 = '/<strong(?:"(?:[^\\\"]|\\\.)*"|\'(?:[^\\\\\']|\\\.)*\'|[^\'">])*>(.*?)<\/strong>/';
preg_match_all($matchPattern7, $content, $foundIt7);
echo substr_count_array(strtolower($foundIt7), strtolower($keyword));
以供参考..
$关键字 = 搜索引擎优化
我是零,有人可以帮忙吗?谢谢