強力なタグ内のキーワードを検索しようとしています。
次のように表示されるタグの配列を作成しました。
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));
参考のために..
$ keyword = seo
私はゼロになっています、誰か助けてもらえますか?ありがとう