Skip to content

Instantly share code, notes, and snippets.

@withremote
Created July 2, 2012 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save withremote/3034778 to your computer and use it in GitHub Desktop.
Save withremote/3034778 to your computer and use it in GitHub Desktop.
If String Contains
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