Created
July 2, 2012 18:32
-
-
Save withremote/3034778 to your computer and use it in GitHub Desktop.
If String Contains
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
if(!function_exists('if_string_contains')) | |
{ | |
function if_string_contains($needle,$haystack) { | |
if (is_array($needle)) { | |
$found_cout = 0; | |
foreach ($needle as $n) { | |
if (strlen(strstr($haystack,$n))>0) { | |
$found_cout++; | |
} | |
} | |
if($found_cout > 0) { | |
return TRUE; | |
} else { | |
return FALSE; | |
} | |
} else { | |
if (strlen(strstr($haystack,$needle))>0) { | |
return TRUE; | |
} else { | |
return FALSE; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment