我完全不知道如何做到這一點,因爲我不是一個正則表達式的專家..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"
是否有任何內置功能來做到這一點?
任何形式的幫助,將不勝感激:)