Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.