Skip to content

Instantly share code, notes, and snippets.

@irazasyed
Created April 14, 2013 12:27
Show Gist options
  • Select an option

  • Save irazasyed/5382523 to your computer and use it in GitHub Desktop.

Select an option

Save irazasyed/5382523 to your computer and use it in GitHub Desktop.
PHP: Check if content contains string
function contains($str, $content, $ignorecase=true) {
if ($ignorecase){
$str = strtolower($str);
$content = strtolower($content);
}
return strpos($content,$str) ? true : false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment