Case-insensitive in_array()

@param string $needle Needle.
@param array $haystack Haystack.
@param bool $strict Strict.
@return bool True/false.
351773
public static function iin_array($needle, $haystack, bool $strict=true) {
		return (false !== static::array_isearch($needle, $haystack, $strict));
	}
14261
private function _inArray($needle, $haystack) {
		foreach ($haystack as $strand) {
			if (fnmatch($strand, $needle)) {
				return true;
			}
		}
		return false;
	}
76339
public static function contains($haystack, $needles)
    {
        $needles = (array) $needles;

        foreach ($needles as $needle) {
            if ($needle && strpos($haystack, $needle) !== false) {
                return true;
            }
        }

        return false;
    }
1155251
public static function endsWith($haystack, $needle) {
		if($needle === null && $haystack === null)
			return true;
		if($needle === null && $haystack !== null)
			return true;
		return $needle === "" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== false);
	}
1332507
public static function collectionContains($needle, $haystack)
    {
        foreach ($haystack as $value) {
            if ($value === $needle) {
                return true;
            }
        }

        return false;
    }
615218
public static function SEARCHINSENSITIVE($needle, $haystack, $offset = 1)
    {
        $needle   = PHPExcel_Calculation_Functions::flattenSingleValue($needle);
        $haystack = PHPExcel_Calculation_Functions::flattenSingleValue($haystack);
        $offset   = PHPExcel_Calculation_Functions::flattenSingleValue($offset);

        if (!is_bool($needle)) {
            if (is_bool($haystack)) {
                $haystack = ($haystack) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
            }

            if (($offset > 0) && (PHPExcel_Shared_String::CountCharacters($haystack) > $offset)) {
                if (PHPExcel_Shared_String::CountCharacters($needle) == 0) {
                    return $offset;
                }
                if (function_exists('mb_stripos')) {
                    $pos = mb_stripos($haystack, $needle, --$offset, 'UTF-8');
                } else {
                    $pos = stripos($haystack, $needle, --$offset);
                }
                if ($pos !== false) {
                    return ++$pos;
                }
            }
        }
        return PHPExcel_Calculation_Functions::VALUE();
    }
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;
    }
742125
public static function stringBeginsWith($haystack, $needle)
    {
        if (!empty($needle) && strncmp($haystack, $needle, strlen($needle)) === 0) {
            return true;
        }

        return false;
    }
1125959
public static function search ($needles, array $haystack, & $key = "", array & $stack = [], $strict = false)
		{
			if (!is_array($needles))
			{
				$needles = [$needles];
			}
			if ($strict)
			{
				foreach ($needles as $needle)
				{
					if ($needle === $haystack)
					{
						$stack[] = $key;

						return $stack;
					}
					foreach ($haystack as $k => $hay)
					{
						if ($needle === $hay)
						{
							$key .= "." . $k;
							$stack[] = $key;
						}
						elseif (is_array($hay))
						{
							$tmpKey0  = $key . "." . $k;
							$tmpStack = static::search($needle, $hay, $tmpKey0, $stack, $strict);
							if (count($tmpStack) >= count($stack))
							{
								$stack = $tmpStack;
							}
						}
					}
				}
			}
			else
			{
				foreach ($needles as $needle)
				{
					if ($needle == $haystack)
					{
						$stack[] = $key;

						return $stack;
					}
					foreach ($haystack as $k => $hay)
					{
						if ($needle == $hay)
						{
							$key .= "." . $k;
							$stack[] = $key;
						}
						elseif (is_array($hay))
						{
							$tmpKey0  = $key . "." . $k;
							$tmpStack = static::search($needle, $hay, $tmpKey0, $stack);
							if (count($tmpStack) >= count($stack))
							{
								$stack = $tmpStack;
							}
						}
					}
				}
			}

			return $stack;
		}
1211909
public static function endsWith($haystack, $needle, $case_sensitive = true)
    {
        $status = false;

        $compare_func = $case_sensitive ? 'mb_strrpos' : 'mb_strripos';

        foreach ((array)$needle as $each_needle) {
            $expectedPosition = mb_strlen($haystack) - mb_strlen($each_needle);
            $status = $each_needle === '' || $compare_func($haystack, $each_needle, 0) === $expectedPosition;
            if ($status) {
                break;
            }
        }

        return $status;
    }
1219199
private function strlikeInArray($needle, array $haystack):bool
    {
        foreach ($haystack as $one => $value) {
            if (preg_match("/$value/", $needle) === 1) {
                return (true);
            }
        }
        return (false);
    }
138235
public static function contains($haystack, $needle)
    {
        foreach ((array)$needle as $n) {
            if (strpos($haystack, $n) !== false) {
                return true;
            }
        }

        return false;
    }
1112711
public function arrayMultiSearch($needle, $haystack) {
        foreach ($haystack as $key => $data) {
            if (in_array($needle, $data)) {
                return $key;
            }
        }
        return false;
    }
259617
public static function endsWith($haystack, $needle, $caseSensitive = true)
    {
        $haystackLength = strlen($haystack);
        $needleLength = strlen($needle);
        if ($haystackLength < $needleLength) {
            return false;
        }

        $haystack = substr($haystack, -$needleLength);
        if (!$caseSensitive) {
            $haystack = strtolower($haystack);
            $needle = strtolower($needle);
        }
        return $haystack == $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;
    }
690571
public static function inString($needle, $haystack, $insensitive = false)
    {
        if ($insensitive) {
            return false !== stristr($haystack, $needle);
        }

        return false !== strpos($haystack, $needle);
    }
1264102
public static function endsWith(
        string $haystack,
        string $needle,
        bool $caseSensitive = false
    ): bool
    {
        $test = substr($haystack, -strlen($needle));
        return ($caseSensitive === false)
            ? strcasecmp($test, $needle) === 0
            : strcmp($test, $needle) === 0;
    }