For an associative multi-dimensional array, pull out the one-dimensional
array along the $key column
Also works if the array consists of objects, not arrays

@param $thing array|object
@param $key   string

@return array|bool
438544
public static function getSubArray($thing, $key)
    {

        if (is_object($thing)) {
            $array = get_object_vars($thing);
        } else {
            $array = $thing;
        }
        if (!is_array($array) || empty($array)) return false;

        $res = array();

        foreach ($array as $idx => $subarray) {
            if (is_object($subarray)) {
                if (isset($subarray->$key)) $res[$idx] = $subarray->$key;
            } else {
                if (isset($subarray[$key])) $res[$idx] = $subarray[$key];
            }
        }

        return $res;
    }
380641
public function load($key)
    {
        $data = $this->adapter->getItem($key, $success);

        if ($success && $this->automaticSerialization) {
            $data = unserialize($data);
            
            if ($data === false) {
                $this->remove($key);
            }
        }

        return $data;
    }
733553
public function getItem($key, $itemId)
    {
        $dataset = $this->getDataset($key);

        foreach ($dataset as $item) {
            if ($item["id"] === $itemId) {
                return $item;
            }
        }
        return null;
    }
525833
protected function splitKey(string $key)
    {
        if (!$this->multilevel) {
            return $key;
        }

        $slug_array = explode($this->separator, $key);

        if (count($slug_array) == 1) {
            return $key;
        }

        return $slug_array;
    }
750948
public function &offsetGet($key) {
        for($i = 0; $i < count($this->arrays); ++$i) {
            if(Util::exists($this->arrays[$i], $key)) {
                return $this->arrays[$i][$key];
            }
        }
        throw new KeyNotFoundException($key);
    }
209070
public static function get($key)
    {
        if ( self::exists($key) ) {
            $key = explode('.', $key);
            $array = self::$arr[$key[0]];
            unset($key[0]);

            foreach ( $key as $k ) {
                $array = $array[$k];
            }

            return $array;
        } else {
            echo '<b>N&atilde;o existe o &iacute;ndice informado no array.</b>';
            return false;
        }
    }
182385
private function parseKey($key)
    {
        if (is_object($key) and $key instanceof AccessKey) {
            return $key;
        }

        $key = AccessKey::create($key);

        return $key;
    }
857133
public static function pick_object( $key, $arr ) 
	{
		if( !is_array( $arr ) ) 
		{
			throw new \InvalidArgumentException('CCArr::pick - second argument has to be an array.');
		}

		$return = array();

		foreach( $arr as $object ) 
		{
			$return[] = $object->{$key};
		}

		return $return;
	}
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;
    }
717547
public function isLast($key)
    {
        if (null === $this->lastKey) {
            end($this->hierarchy);
            $this->lastKey = key($this->hierarchy);
        }

        return $key === $this->lastKey;
    }
1001772
public function get($key, $locale = null) {
        $segments = $this->parseKey($key);
        $group = $segments[0];
        $item = $segments[1];

        if ("" == $group) {
            return "";
        }

        $localeArray = $this->parseLocale($locale);
        foreach ($localeArray as $locale) {
            $this->load($group, $locale);

            if (isset($this->loaded[$group][$locale])) {
                if (null == $item) {
                    return $this->loaded[$group][$locale];
                } elseif (isset($this->loaded[$group][$locale][$item])) {
                    return $this->loaded[$group][$locale][$item];
                }
            }
        }

        return "";
    }
534859
public static function lists($array, $key)
    {
        $result = [];
        foreach ($array as $element) {
            $value = static::get($element, $key);
            $result[$value] = $element;
        }

        return $result;
    }
1281648
public function offsetGet($key)
    {
        $this->_materialize($key);

        $result = null;
        if (isset($this->_property[$key])) {
            $result = $this->_property[$key];
        }

        return $result;
    }
408443
protected function normalizeKey($key)
    {
        if (preg_match(static::$arrayKey, $key, $matches)) {
            $key = $matches[1];
            return $key;
        }
        return $key;
    }
215345
public function findItemByKey(string $key)
    {
        return $this->items->first(function (BaseItem $item, $index) use ($key) {
            return $item->getKey() == $key;
        });
    }
1199367
private function lookupKey($key)
    {
        foreach ($this->pairs as $pair) {
            if ($this->keysAreEqual($pair->key, $key)) {
                return $pair;
            }
        }
    }
330517
public function extractKey($key)
    {
        $self       = clone($this);
        $self->data = Accessor::get($this->data, $key) ?: [];
        return $self;
    }