Last active
December 19, 2015 16:48
-
-
Save fhferreira/5986118 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| /* strpos that takes an array of values to match against a string | |
| * note the stupid argument order (to match strpos) | |
| */ | |
| function strpos_arr($haystack, $needle) { | |
| if(!is_array($needle)) $needle = array($needle); | |
| foreach($needle as $what) { | |
| if(($pos = strpos($haystack, $what))!==false) return $pos; | |
| } | |
| return false; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment