Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save talha08/83ebcd2288ea29efca088e759c40b589 to your computer and use it in GitHub Desktop.

Select an option

Save talha08/83ebcd2288ea29efca088e759c40b589 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<body>
<?php
$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";
$words = array("women", "murder","rape","female","dowry");
$sum = 0;
foreach($words as $word) {
// $word." occurance are ".substr_count($string, $word)." times <br />";
$total = substr_count($string, $word);
$sum = $sum + $total;
}
echo $sum;
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment