src/StringLib.php
/**
     * Find out whether the $needle string contains the $haystack string.
     * This will use strpos rather than strstr because strpos is faster and less
     * memory intensive.
     * https://stackoverflow.com/questions/5820586/which-method-is-preferred-strstr-or-strpos
     * @return bool - true if does contain, false if not
     */
Find out whether the $needle string contains the $haystack string.
This will use strpos rather than strstr because strpos is faster and less
memory intensive.
Find out whether the $needle string contains the $haystack string . This will use strpos rather than strstr because strpos is faster and less memory intensive .
public static function contains($haystack, $needle, $caseSensitive = true)
    {
        if ($caseSensitive)
        {
            $pos = strpos($haystack, $needle);
        }
        else
        {
            $pos = strpos($haystack, $needle);
        }
        return ($pos !== FALSE);
    }
public static function contains ( $ haystack , $ needle , $ caseSensitive = true ) { if ( $ caseSensitive ) { $ pos = strpos ( $ haystack , $ needle ) ; } else { $ pos = strpos ( $ haystack , $ needle ) ; } return ( $ pos !== FALSE ) ; }
Find out whether the $needle string contains the $haystack string.
Find out whether the $needle string contains the $haystack string .
# Need to be careful to by type sensitive here because could return value 0 which would # need to return true.