-
-
Save Cloud-Dark/eefa21bea35877b00c5eaae7927b5909 to your computer and use it in GitHub Desktop.
Check if string contains word from array.
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
/** | |
* array_contains | |
* Check if string contains word from array. | |
* | |
* @since 1.0.0 | |
* @version 1.0.0 | |
**/ | |
function array_contains($str, array $arr){ | |
foreach($arr as $a){ | |
if(stripos($str, $a) !== false) return true; | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment