Last active
October 20, 2018 02:17
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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