Skip to content

Instantly share code, notes, and snippets.

@nikita2206
Forked from withremote/gist:3034778
Created July 2, 2012 19:26
Show Gist options
  • Save nikita2206/3035134 to your computer and use it in GitHub Desktop.
Save nikita2206/3035134 to your computer and use it in GitHub Desktop.
If String Contains
<?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