-
-
Save billhance/3036863 to your computer and use it in GitHub Desktop.
If String Contains
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 | |
if(!function_exists('if_string_contains')) | |
{ | |
function if_string_contains($needle,$haystack) { | |
if (is_array($needle)) { | |
foreach ($needle as $n) { | |
if (strpos($haystack, $n) !== false) { | |
return true; | |
} | |
} | |
} else { | |
return strpos($haystack, $needle) !== false; | |
} | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment