-
-
Save mdeora/80d4476bbd29e2c51a137f1b4dd50cff to your computer and use it in GitHub Desktop.
PHP: strpos_array is strpos that can take an array as needle
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 strpos_array($haystack, $needles, $offset = 0) { | |
if (is_array($needles)) { | |
foreach ($needles as $needle) { | |
$pos = strpos_array($haystack, $needle); | |
if ($pos !== false) { | |
return $pos; | |
} | |
} | |
return false; | |
} else { | |
return strpos($haystack, $needles, $offset); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment