Given an array value determine if it exists in the array and return the value as it is in the array.

@param string $needle
@param array $haystack
@return string|null
975820
public static function arraySearchGetValue($needle, array $haystack)
    {
        $lcNeedle = strtolower($needle);

        foreach ($haystack as $value) {
            if ($lcNeedle == strtolower($value)) {
                return $value;
            }
        }

        return null;
    }
1202321
public static function hasAnyKey(array $haystack, ...$needles)
    {
        foreach ($needles as $needle) {
            if (array_key_exists($needle, $haystack)) {
                return true;
            }
        }

        return false;
    }
1013213
protected function stringHasStatement( $haystack, $needle ) {
		$pattern = '~^\s*(' . preg_quote( $needle, '~' ) . ')\s*$~m';
		return (bool) preg_match( $pattern, $haystack );
	}
413644
public static function targetGet($needle, array $haystack, $default = null)
    {
        if ($needle === null) {
            return $haystack;
        }

        $parts  = preg_split('/(?<!\\\\)\./', $needle);

        foreach ($parts as $part) {
            $key = str_replace('\\.', '.', $part);

            if (
                is_array($haystack) === false ||
                array_key_exists($key, $haystack) === false
            ) {
                return $default;
            }

            $haystack = $haystack[$part];
        }

        return $haystack;
    }
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;
    }
1360988
public static function unsetInArrayByValue($needle, array $haystack, $reIndex = true)
    {
        $doReindex = false;

        foreach($haystack as $key => $value) {
            if (is_array($value)) {
                $haystack[$key] = static::unsetInArrayByValue($needle, $value);
            } else if ($needle === $value) {

                unset($haystack[$key]);

                if ($reIndex) {
                    $doReindex = true;
                }
            }
        }

        if ($doReindex) {
            $haystack = array_values($haystack);
        }

        return $haystack;
    }
794565
public static function exists(SimpleXMLElement $needle, SimpleXMLElement $haystack){
        foreach($haystack as $item){
            if($item->asXML() == $needle->asXML())
                return true;
        }
        return false;
    }
583910
public static function pos($haystack, $needle, $offset = 0)
    {
        if (self::isMBString()) {
            return mb_strpos($haystack, $needle, $offset, self::$encoding);
        }

        return strpos($haystack, $needle, $offset); // @codeCoverageIgnore
    }
189897
public static function contains($haystack, $needles)
    {
        foreach ((array) $needles as $needle) {
            if ($needle !== '' && mb_strpos($haystack, $needle) !== false) {
                return true;
            }
        }

        return false;
    }
991230
public function match($needle, $haystack)
    {
        $len = strlen($needle);

        /** @noinspection SubStrUsedAsStrPosInspection */
        return $len === 0 || substr($haystack, 0, $len) === $needle;
    }
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;
    }
14261
private function _inArray($needle, $haystack) {
		foreach ($haystack as $strand) {
			if (fnmatch($strand, $needle)) {
				return true;
			}
		}
		return false;
	}
1324042
protected function searchNamespace($needle, $haystack)
    {
        $needle = realpath($needle);
        $haystack = array_map('realpath', $haystack);

        $key = array_search($needle, $haystack);

        return is_string($key) ? trim($key, '\\') : null;
    }
441400
public static function startsWith($haystack, $needle)
    {
        $length = strlen($needle);

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

        return false;
    }
187255
protected function string_contains( $haystack, $needles ) {
		foreach ( (array) $needles as $needle ) {
			if ( '' !== $needle && mb_strpos( $haystack, $needle ) !== false ) {
				return true;
			}
		}

		return false;
	}
1003507
public static function contains(string $haystack, string $needle, int $offset = 0): bool
    {
        return self::strpos($haystack, $needle, $offset) !== false;
    }