I need to count some specific words in string(How many times some word occurs in a string), How can I do it in php?
Example;
$words = array("woman", "murder", "rape", "female", "dowry");
$string = "A dowry deaths is a murder or suicide of a married woman caused by a dispute over her dowry.[4] In some cases, husbands and in-laws will attempt to extort a greater dowry through continuous harassment and torture which sometimes results in the wife committing suicide";
The first item is the bundle of some word, If this word match with below string increase its value....
Example of result like be:
dowry= 1;
murder =2;
women =5;