Convenience function for getting array values.  Given an array
$arr and a key $key, get the corresponding value from the array
or return $default if the key is absent.

@access private
16643
public function arrayGet($arr, $key, $fallback = null)
    {
        if (is_array($arr)) {
            if (array_key_exists($key, $arr)) {
                return $arr[$key];
            } else {
                return $fallback;
            }
        } else {
            trigger_error("Auth_OpenID::arrayGet (key = ".$key.") expected " .
                          "array as first parameter, got " .
                          gettype($arr), E_USER_WARNING);

            return false;
        }
    }
1060579
public function get($key, $default = null)
    {
        $array = $this->data;
        foreach (explode(self::SEPERATOR, $key) as $item) {
            if (is_array($array) && array_key_exists($item, $array)) {
                $array = $array[$item];
            } else {
                return $default;
            }
        }

        return $array;
    }
699085
protected function arrayValue($key, $arrayKey, $value = null)
    {
        $array = $this[$key];
        $is = is_array($array);
        if (null !== $value) {
            if (!$is) {
                $array = array_key_exists($key, self::DEFAULTS)
                    ?self::DEFAULTS[$key]
                    :$this::DEFAULTS[$key];
            }
            $array[$arrayKey] = $value;
            $this[$key] = $array;
            return null;
        } else {
            return $is && isset($array[$arrayKey])
                ?$array[$arrayKey]
                :null;
        }
    }
1297806
public static function get(array $array, $key, $default = null)
    {
        if (array_key_exists($key, $array)) {
            return $array[$key];
        }

        if (strpos($key, '.') === false) {
            return $default;
        }

        foreach (explode('.', $key) as $segment) {
            if (is_array($array) && array_key_exists($segment, $array)) {
                $array = $array[$segment];
            } else {
                return $default;
            }
        }

        return $array;
    }
1271233
public function getFromArray(string $key, array $data, string $default = null)
    {
        $value = $default;

        if (\array_key_exists($key, $data)) {
            $value = $data[$key];
        }

        return $value;
    }
1054452
public static function pull(&$array, $key, $default = null)
    {
        if (array_key_exists($key, $array)) {
            $value = $array[$key];
            unset($array[$key]);
        } else {
            $value = $default;
        }

        return $value;
    }
808044
public static function get($array, $key, $default = null)
    {
        if (null === $key) {
            return $array;
        }

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

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

        return $array;
    }
614110
public static function arrayRemove($arr, $key, $default = null)
    {
        if (isset($arr[$key])) {
            $value = $arr[$key];
            unset($arr[$key]);

            return $value;
        }

        return $default;
    }
393756
public static function get($array, $key = null, $default = null, $opr = null)
    {
        if (!self::isReallyArray($array)) {
            return $default;
        }
        if (null === $key) {
            return $array;
        }
        if (array_key_exists($key, $array)) {
            return $array[$key];
        }

        if (null !== $opr) {
            if (strpos($key, $opr) === false) {
                return $array[$key] ?? $default;
            }

            foreach (explode($opr, $key) as $k) {
                if (self::isReallyArray($array) && array_key_exists($k, $array)) {
                    $array = $array[$k];
                } else {
                    return $default;
                }
            }

            return $array;
        }

        return $default;
    }
549591
public static function array_get($arr, $path, $default=null) {
		if(!is_array($path))
			$path = [$path];
		foreach($path as $key) {
			if(!isset($arr[$key]))
				return $default;
			else
				$arr = $arr[$key];
		}
		return $arr;
	}
388070
public static function Arr($array, $filter = null, $default = array())
  {
    if (empty($array) || !is_array($array)) {
      return $default;
    }

    $out = false;
    foreach ($array as $key => $val) {
      if (!is_null(static::Value($val, $filter, null))) {
        $out[$key] = $val;
      }
    }

    return $out ?: $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;
	}
41453
public function getGet($key, $default_val = null)
    {

        if (isset($this->get[$key])) {
            return $this->get[$key];
        }

        return $default_val;
    }
500106
public static function set( $key, $value, &$arr ) 
	{	
		if ( strpos( $key, '.' ) === false ) 
		{
			$arr[$key] = $value;

		} 
		else 
		{
			$kp = explode( '.', $key );

			switch ( count( $kp ) ) 
			{
				case 2:
					$arr[$kp[0]][$kp[1]] = $value; break;
				case 3:
					$arr[$kp[0]][$kp[1]][$kp[2]] = $value; break;	
				case 4:
					$arr[$kp[0]][$kp[1]][$kp[2]][$kp[3]] = $value; break;

				// if there are more then 4 parts loop trough them
				default:
					$kp = array_reverse( $kp );
					$curr = $value;

					foreach( $kp as $k ) 
					{
						$curr = array( $k => $curr );
					}

					$arr = static::merge( $arr, $curr );
				break;
			}
		}
		return $arr;
	}
128881
public function getValue(
        array $array,
        string $key,
        $defaultValue = null,
        bool $splitKey = true,
        string $checkedValue = null
    ) {
        if (empty($array) || (empty($key) && ! $key === 0)) {
            return $defaultValue;
        }

        if ( ! $splitKey && array_key_exists($key, $array)) {
            return $array[ $key ];
        }

        $keys = $splitKey ? preg_split('/:/', $key) : [$key];

        if ( ! empty($keys)) {
            $firstKey = trim(array_shift($keys));

            if ($checkedValue && count($keys) === 0) {
                if (array_key_exists($firstKey, $array) && $array[ $firstKey ] == $checkedValue) {
                    return $array;
                }

                foreach ($array as $arrayItem) {
                    if (is_array($arrayItem) && array_key_exists($firstKey, $arrayItem) &&
                        $arrayItem[ $firstKey ] == $checkedValue) {
                        return $arrayItem;
                    }
                }
            } else if (preg_match('/^\[([\w_-]+)=(.+)\]$/', $firstKey, $matches)) {
                $valueKey = array_key_exists(1, $matches) ? $matches[ 1 ] : null;
                $valueValue = array_key_exists(2, $matches) ? $matches[ 2 ] : null;

                foreach ($array as $value) {
                    if (is_array($value)) {
                        $valueKeys = array_keys($value);

                        foreach ($valueKeys as $nextValueKey) {
                            if (strcasecmp($nextValueKey, $valueKey) == 0 && array_key_exists($nextValueKey, $value) &&
                                $value[ $nextValueKey ] == $valueValue) {
                                if (count($keys) > 0) {
                                    return $this->getValue($value, join(':', $keys), $defaultValue);
                                } else {
                                    return $value;
                                }
                            }
                        }
                    }
                }
            } else {
                $arrayKeys = array_keys($array);

                foreach ($arrayKeys as $arrayKey) {
                    if (strcasecmp($arrayKey, $firstKey) == 0) {
                        $result = array_key_exists($arrayKey, $array) ? $array[ $arrayKey ] : null;

                        if (is_array($result) && count($keys) > 0) {
                            return $this->getValue($result, join(':', $keys), $defaultValue, $splitKey, $checkedValue);
                        } else if (count($keys) === 0) {
                            return $result;
                        } else {
                            return $defaultValue;
                        }
                    }
                }
            }
        }

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

        return $defaultValue;
    }
878905
static function init(&$arr, $key, $default = null) 
    {
        if (! isset($arr[$key])) {
            $arr[$key] = $default;
        }
        return $arr[$key];
    }