Skip to content

Instantly share code, notes, and snippets.

@jgwill
Last active October 20, 2018 02:17
Show Gist options
  • Save jgwill/e77587a87f094eb483985b38a4c847fd to your computer and use it in GitHub Desktop.
Save jgwill/e77587a87f094eb483985b38a4c847fd to your computer and use it in GitHub Desktop.
Check in PHP if a String is contained into another and return true if it does
/**
* Return true if the Pattern is contained within the string
*
* Return true if the Pattern is contained within the string
*
* PHP version 5.6
*
* LICENSE:
*
* @category String
* @package PS.Common
* @author J. Guillaume Isabelle
* @copyright 2018 GI
* @license
* @version
* @link
* @see
* @since
*/
function str_contain($pattern,$str)
{
if (strpos($str, $pattern) !== false) {
return true;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment