Get an item from an array.

@param array  $array
@param string $key
@param mixed  $default
@param bool   $useDotSyntax

@return mixed
965783
public static function get($array, $key = null, $default = null, $useDotSyntax = false)
    {
        // Check arguments
        if (empty($array)) {
            return $default;
        }

        // Check if key is empty
        if (is_null($key)) {
            return $array;
        }

        // Check if value exists as is
        if (isset($array[$key])) {
            return $array[$key];
        }

        // Return default value, without dot syntax
        if (!$useDotSyntax) {
            return $default;
        }

        // Split name using dots
        $keyParts = explode('.', $key);
        if (count($keyParts) == 1) {
            return isset($array[$key]) ? $array[$key] : $default;
        }

        // Recursive call
        $base = $keyParts[0];
        unset($keyParts[0]);

        // Check if the base array exists
        if (!isset($array[$base])) {
            return $default;
        }

        // Get key, base array and continue
        $key = implode('.', $keyParts);
        $array = $array[$base];

        return static::get($array, $key, $default, $useDotSyntax);
    }
1165466
public function get($key, $default = null)
	{
		return is_array($this->response) ? \Arr::get($this->response, $key, $default) : $default;
	}
311713
public static function getInt(array $array, $key, int $default = 0) : int
    {
        $key = (string) $key;

        if ($array[$key] ?? 0) {
            return (int) $array[$key];
        }

        return $default;
    }
632177
public static function get( $array, $key, $default = NULL )
    {
        if ( is_null( $key ) ) return $array;

        if ( isset( $array[ $key ] ) ) return $array[ $key ];

        foreach ( explode( '.', $key ) as $segment )
        {
            if ( !is_array( $array ) || !array_key_exists( $segment, $array ) )
            {
                return Util::value( $default );
            }

            $array = $array[ $segment ];
        }

        return $array;
    }
7484
public static function get(
        array $params,
        string $key,
        $default = null
    ) {
        if (self::has($params, $key)) {
            return $params[$key];
        }

        return $default;
    }
830930
public function get(array $array, $keys, $default = null)
    {
        $keys = $this->parseKeys($keys);

        if (is_array($array) && $keys) {
            $key = array_shift($keys);
            if (array_key_exists($key, $array)) {
                $value = $array[$key];
                if (!$keys) {
                    return $value;
                }

                if (is_array($value)) {
                    return $this->get($value, $keys, $default);
                }
            }
        }

        return $default;
    }
953053
public static function get($array, $key, $default = null)
	{
		if (!static::accessible($array))
			return value($default);

		if (is_null($key))
			return $array;

		if (static::exists($array, $key))
			return $array[(string) $key];


		foreach (static::toKey($key) as $segment) {
			if (static::accessible($array) && static::exists($array, $segment)) {
				$array = $array[$segment];
			} else {
				return value($default);
			}
		}

		return $array;
	}
736608
public static function set($array, $key, $value = null, $useDotSyntax = false)
    {
        // Normalize array
        $array = $array ?: [];

        // Check if key is empty
        if (StringHelper::emptyString($key, true)) {
            throw new InvalidArgumentException(__METHOD__ . ': Key cannot be empty');
        }

        /**
         * Split name using dots.
         *
         * Just checking whether the key doesn't have any dots
         * but $useDotSyntax is true by default.
         */
        $keyParts = explode('.', $key);
        $useDotSyntax = $useDotSyntax && count($keyParts) > 1;

        // Set simple value, without dot syntax
        if (!$useDotSyntax) {
            if (is_null($value) && isset($array[$key])) {
                unset($array[$key]);
            } elseif (!is_null($value)) {
                $array[$key] = $value;
            }
        } else {
            // Recursive call
            $base = $keyParts[0];
            unset($keyParts[0]);

            // Check if the base array exists
            if (!isset($array[$base])) {
                $array[$base] = [];
            }

            // Get key, base array and continue
            $key = implode('.', $keyParts);
            $innerArray = $array[$base];

            $array[$base] = static::set($innerArray, $key, $value, $useDotSyntax);
        }

        return $array;
    }
584933
public static function removeValue(&$array, $key, $default = null)
    {
        if (is_array($array)) {
            $value = static::getValue($array, $key, $default);
            unset($array[$key]);
            return static::value($value);
        }
        return self::value($default);
    }
1313613
public static function pluck($array, string $key, $defaultValue = null): array
    {
        $result = [];
        if (!is_array($array)) {
            return $result;
        }

        // Extract key/path.
        $keyLast = Str::last($key, '.');
        $key = Str::removeLast($key, '.');

        // Extract data.
        if ($key !== '' && $key !== null) {
            $array = self::dataByPath($array, $key, false, []);
        }
        foreach ($array as $item) {
            $value = $defaultValue;
            if (is_object($item) && isset($item->{$keyLast})) {
                $value = $item->{$keyLast};
            } elseif (is_array($item) && isset($item[$keyLast])) {
                $value = $item[$keyLast];
            }
            $result[] = $value;
        }

        return $result;
    }
1143959
public function getSafeArray(string $key, array & $data, string $default = null)
    {
        $value = $this->getFromArray($key, $data, $default);

        return \htmlspecialchars($value);
    }
1044874
public function pull($key, $default = null)
    {
        if (is_array($key)) {
            return $this->pullMany($key, $default);
        }

        return parent::pull($key, $default);
    }
770382
public function get($key, $default = null)
    {
        if (is_array($key)) {
            return $this->many($key);
        }

        $value = $this->store->get($this->itemKey($key));

        if (is_null($value) || $value === false) {
            $this->fireCacheEvent('missed', [$key]);

            $value = value($default);
        } else {
            $this->fireCacheEvent('hit', [$key, $value]);
        }

        return $value;
    }
1163195
protected static function array_key_exists( $key, $array, $useIsset = false )
    {
        if ( !is_array( $key ) )
        {
            $key = array($key);
        }

        foreach ( $key as $_key )
        {
            if ( ( $useIsset && isset( $array[$_key] ) ) || array_key_exists( $_key, $array ) )
            {
                return $_key;
            }
        }

        return false;
    }
934341
public static function get($key, $default = null) {

		if(true === is_array($key)) {

			$tmp = static :: $data;

			foreach($key as $index) {

				if(false === isset($tmp[$index])) {
					return $default;
				}

				$tmp = $tmp[$index];
			}

			return $tmp;
		}

		if(true === isset(static :: $data[$key])) {
			return static :: $data[$key];
		}

		return $default;
	}
1073123
public static function getString(array $array, $key, string $default = '') : string
    {
        $key = (string) $key;

        if ($array[$key] ?? 0) {
            return (string) $array[$key];
        }

        return $default;
    }
345569
public function getKey(array $array, string $value, $defaultValue = null)
    {
        foreach ($array as $key => $nextValue) {
            if (strcasecmp($nextValue, $value) == 0) {
                return $key;
            }
        }

        return $defaultValue;
    }