Created
November 13, 2015 09:09
-
-
Save t-cyrill/c363faec8fc490a59e84 to your computer and use it in GitHub Desktop.
preg_match_any
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
/** | |
* preg_match | |
* | |
* @param array $patterns preg_matchに渡せるpattern文字列の配列 | |
* @param string $subject 調べる文字列 | |
*/ | |
function preg_match_any(array $patterns, $subject) { | |
foreach ($patterns as $pattern) { | |
if (preg_match($pattern, $subject) === 1) return true; | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
雑い