Created
October 25, 2012 13:57
-
-
Save Stichoza/3952685 to your computer and use it in GitHub Desktop.
PHP substr_count for arrays (needle array)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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