Skip to content

Instantly share code, notes, and snippets.

@Stichoza
Created October 25, 2012 13:57
Show Gist options
  • Save Stichoza/3952685 to your computer and use it in GitHub Desktop.
Save Stichoza/3952685 to your computer and use it in GitHub Desktop.
PHP substr_count for arrays (needle array)
<?php
function substr_count_array($haystack, $needle) {
$count = 0;
$haystack = strtolower($haystack);
foreach ($needle as $substring) {
$count += substr_count($haystack, strtolower($substring));
}
return $count;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment