Search one of the given needs in the array
@param string $haystack
@param array $needles
@return bool|string
340438
private function strpos_array($haystack, array $needles)
    {
        $closer = 10000;
        foreach($needles as $needle) {
            if (false !== $pos = strpos($haystack, $needle)) {
                if ($pos < $closer) {
                    $closer = $pos;
                }
            }
        }

        return 10000 === $closer ? false : $closer;
    }
30804
public static function isNeedlesExists($haystack, $needles) {
        foreach($needles as $needle) {
            if(stripos($haystack, $needle)!==false){
                return true;
            }
        }
        return false;
    }
483320
public static function contains($haystack, $needle)
    {
        if (1 === strlen($needle) && !self::isLetterOrDigit($needle)) {
            $needle = '\\' . $needle;
        }

        return (bool)preg_match('|.*' . $needle . '.*|', $haystack);
    }
821409
public static function contains($haystack, $needle, $checkAll = false) {
        $contains = false;

        if (is_string($needle)) {
            if (strstr($haystack, $needle)) {
                $contains =  true;
            } else {
                return $contains;
            }
        } else if (is_array($needle) && !$checkAll) {
            foreach ($needle as $check) {
                if (strstr($haystack, $check)) {
                    $contains = true;
                }
            }
        } else if (is_array($needle) && $checkAll) {
            $checked_needles = [];
            foreach ($needle as $check) {
                if (strstr($haystack, $check)) {
                    $checked_needles[] = $check;
                }
            }
            if (count($checked_needles) == count($needle)) {
                $contains = true;
            }
        }

        return $contains;
    }
927494
public static function contains(string $haystack, string $needle): bool
    {
        return mb_strpos($haystack, $needle, 0, 'UTF-8') !== false;
    }
1291942
public static function words_match($haystack, $needle)
    {
        $a_needle  = self::tokenize_string($needle, 1);
        $_haystack = join(" ", self::tokenize_string($haystack, 1));
        $valid     = strlen($_haystack) > 0;
        $hits      = 0;

        foreach ($a_needle as $w) {
            if ($valid) {
                if (stripos($_haystack, $w) !== false) {
                    $hits++;
                }
            }
            else if (stripos($haystack, $w) !== false) {
                $hits++;
            }
        }

        return $hits >= count($a_needle);
    }
1059153
public static function contains(string $haystack, string $needle, bool $caseSensitive = true)
    {
        if ($caseSensitive) {
            return $needle === '' || strpos($haystack, $needle) !== false;
        }

        return $needle === '' || stripos($haystack, $needle) !== false;
    }
1180209
public static function containsOneOf($haystack, array $needles)
    {
        foreach ($needles as $needle) {
            if ($needle !== '' && mb_strpos($haystack, $needle) !== false) {
                return true;
            }
        }

        return false;
    }
1143622
public function starts_with( $haystack, $needle ) {
		if ( '' === $haystack || '' === $needle ) {
			return false;
		}
		if ( $haystack === $needle ) {
			return true;
		}

		return strncmp( $haystack, $needle, strlen( $needle ) ) === 0;
	}
1146110
public function arrayKeyExistsRecursiveExtended(string $needle, array $haystack): bool
    {
        $result = false;
        foreach ($haystack as $value) {
            if (true === is_array($value)) {
                $result = $this->arrayKeyExistsRecursive($needle, $value);
            }
            if (true === $result) {
                return $result;
            }
        }

        return $result;
    }
286387
static function contains($haystack, $needles, $strict = true)
    {
        // 不区分大小写的情况下 全部转为小写
        if (!$strict) $haystack = mb_strtolower($haystack);

        // 支持以数组方式传入 needles 检查多个字符串
        foreach ((array)$needles as $needle) {
            if (!$strict) $needle = mb_strtolower($needle);
            if ($needle != '' && mb_strpos($haystack, $needle) !== false) {
                return true;
            }
        }
        return false;
    }
323441
public static function searchRecursive($needle, $haystack, $needleKey = "", $strict = false, $path = [])
    {
        if (!is_array($haystack)) {

            return false;
        }

        foreach ($haystack as $key => $val) {
            if (is_array($val) &&
                $subPath = self::searchRecursive($needle, $val, $needleKey, $strict, $path)
            ) {
                $path = array_merge($path, [$key], $subPath);

                return $path;
            } elseif ((!$strict && ($val == $needle || is_null($needle)) &&
                    $key == (strlen($needleKey) > 0 ? $needleKey : $key)) ||
                ($strict && $val === $needle &&
                    $key == (strlen($needleKey) > 0 ? $needleKey : $key))
            ) {
                $path[] = $key;

                return $path;
            }
        }

        return false;
    }
454451
public static function inArray($needle, $haystack, $index)
    {
        foreach($haystack as $element)
        {
            if($element[$index] == $needle) return true;
        }
        return false;
    }
105518
public static function filterCaseInsensitively(array $needles, array $haystack)
    {
        $result = array();
        $modifiedHaystack = array_change_key_case($haystack, CASE_LOWER);
        foreach ($needles as $needle) {
            $modifiedNeedle = strtolower($needle);
            if (array_key_exists($needle, $haystack)) {
                $result[$needle] = $haystack[$needle];
            } elseif (array_key_exists($modifiedNeedle, $modifiedHaystack)) {
                $result[$needle] = $modifiedHaystack[$modifiedNeedle];
            }
        }
        return $result;
    }
284571
public static function array_isearch($needle, array $haystack, bool $strict=true) {
		if (! \count($haystack)) {
			return false;
		}

		// Lowercase for comparison.
		ref\mb::strtolower($needle, true);
		ref\mb::strtolower($haystack, true);

		// phpcs:disable
		return array_search($needle, $haystack, $strict);
		// phpcs:enable
	}
819572
public static function inArrayCaseInsensitive($needle, $haystack)
    {
        if (!$haystack || !is_array($haystack)) {
            return false;
        }
        $lcase = array();
        foreach ($haystack as $key => $val) {
            $lcase[$key] = strtolower($val);
        }
        return in_array(strtolower($needle), $lcase);
    }
1312080
public static function has(string $needle, string $haystack): bool
    {
        return $needle === '' || strpos($haystack, $needle) !== false;
    }