Determine if a given string contains a given substring.

@param  string       $haystack The given string.
@param  string|array $needles  An array or string to check.
@return bool
187255
protected function string_contains( $haystack, $needles ) {
		foreach ( (array) $needles as $needle ) {
			if ( '' !== $needle && mb_strpos( $haystack, $needle ) !== false ) {
				return true;
			}
		}

		return false;
	}
811711
protected function tagSearch($needle, array $haystack)
    {
        foreach ($haystack as $actual) {
            if (0 === strcasecmp($needle, $actual)) {
                return $actual;
            }
        }

        return null;
    }
266365
public static function endWith(string $haystack, string $needle): bool
    {
        return ($needle === mb_substr($haystack, -mb_strlen($needle, 'UTF-8'), null, 'UTF-8'));
    }
1305279
public static function getStartsWith($haystack, $needles)
    {
        foreach ((array) $needles as $needle) {
            if ($needle != '' && strpos($haystack, $needle) === 0) {
                return $needle;
            }
        }

        return false;
    }
1045059
public static function hasAllValuesMultiDimensional(array $haystack, array $needles)
    {
        $return = true;
        foreach ($needles as $needle) {
            if (!in_array($needle, $haystack)) {
                $return = false;
                break;
            }
        }

        return $return;
    }
794565
public static function exists(SimpleXMLElement $needle, SimpleXMLElement $haystack){
        foreach($haystack as $item){
            if($item->asXML() == $needle->asXML())
                return true;
        }
        return false;
    }
1293537
public function endswith(string $haystack, string $needle) : bool
    {
        return (substr($haystack, -1 * strlen($needle)) === $needle);
    }
702805
public static function containsAll($haystack, array $needles)
    {
        foreach ($needles as $needle) {
            if ($needle != '' && mb_strpos($haystack, $needle) === false) {
                return false;
            }
        }

        return true;
    }
441400
public static function startsWith($haystack, $needle)
    {
        $length = strlen($needle);

        return substr($haystack, 0, $length) === $needle;
    }
658158
public function hasKey(string $needle, array $haystack) : bool
    {
        foreach ($haystack as $key => $value) {
            if ($key === $needle) {
                return true;
            }

            if (is_array($value)) {
                if ($x = $this->hasKey($needle, $value)) {
                    return $x;
                }
            }
        }

        return false;
    }
1013213
protected function stringHasStatement( $haystack, $needle ) {
		$pattern = '~^\s*(' . preg_quote( $needle, '~' ) . ')\s*$~m';
		return (bool) preg_match( $pattern, $haystack );
	}
1316621
public static function endsWith($haystack, $needles)
    {
        foreach ((array) $needles as $needle) {
            if (substr($haystack, -strlen($needle)) === (string) $needle) {
                return true;
            }
        }

        return false;
    }
1285782
public static function startsWith($haystack, $needle) {
		if($needle === null && $haystack === null)
			return false;
		if($needle === null && $haystack !== null)
			return true;
		return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false;
	}
244934
public function arraySearch($needle, $haystack)
    {
        if (empty($needle) || empty($haystack)) {
            return false;
        }

        foreach ($haystack as $key => $value) {
            $exists = 0;
            foreach ($needle as $nkey => $nvalue) {
                if (!empty($value[$nkey]) && $value[$nkey] === $nvalue) {
                    $exists = 1;
                } else {
                    $exists = 0;
                }
            }

            if ($exists) {
                return $key;
            }
        }

        return false;
    }
680531
public static function startsWith(string $haystack, string $needle) : bool
    {
        return !strncmp($haystack, $needle, strlen($needle));
    }
189897
public static function contains($haystack, $needles)
    {
        foreach ((array) $needles as $needle) {
            if ($needle !== '' && mb_strpos($haystack, $needle) !== false) {
                return true;
            }
        }

        return false;
    }
229443
public static function StartsWith($haystack, $needle)
    {
        $length = static::Length($needle);

        return substr($haystack, 0, $length) === $needle;
    }