I完全に私は正規表現の専門家ではないですとしてこれを行う方法は考えている。..PHP:文字列内の指定されたテキストを検索およびカウントする方法は?
しかし、私は、たとえば、長い文字列で指定された大文字と小文字を区別しないテキストを検索し、カウントしたい:
機能:
int count_string (string $string_to_search, string $input_search)
使用例と結果:
$my_string = "Hello my name is John. I love my wife, child, and dog very much. My job is a policeman."; print count_string("my", $my_string); // prints "3" print count_string("is", $my_string); // prints "2"
これを行うには、任意の組み込み関数はありますか?
ヘルプの任意の種類をいただければ幸いです:)