Pluck an array of values from an array.

@param array  $array
@param string $value
@param string $key

@return array
11836
public static function pluck( $array, $value, $key = NULL )
    {
        $result = [ ];

        foreach ( $array as $item )
        {
            $itemValue = is_object( $item ) ? $item->{$value} : $item[ $value ];

            if ( is_null( $key ) )
            {
                $result[ ] = $itemValue;
            }
            else
            {
                $itemKey = is_object( $item ) ? $item->{$key} : $item[ $key ];

                $result[ $itemKey ] = $itemValue;
            }
        }

        return $result;
    }
1148968
public static function removeByValue($array, $value): array
    {
        if (! Assert::array($array)) {
            throw new InvalidArgumentException(
                '`Arr::removeByValue` first parameter must be `array` or implements interface `ArrayAccess`'
            );
        }

        foreach ($array as $i => $val) {
            if (trim($val) === trim($value)) {
                unset($array[$i]);
            }
        }

        return $array;
    }
384491
public function pluck(array $collection, $key)
    {
        $values = [];

        foreach ($collection as $node)
        {
            if ( ! isset($node[$key]))
            {
                continue;
            }

            $values[] = $node[$key];
        }

        return $values;
    }
1197700
public function addDeepValue(array $array, array $keys, $value)
    {
        if (count($keys) > 1) {
            $key = array_shift($keys);
            $firstArray = array_key_exists($key, $array) ? $array[ $key ] : [];
            $array[ $key ] = $this->addDeepValue($firstArray, $keys, $value);
        } else {
            $key = array_shift($keys);
            $array[ $key ] = $value;
        }

        return $array;
    }
196014
public function checarValorArrayMultidimensional($key, $value, array $array)
    {
        foreach ($array as $a) {
            if (isset($a[$key]) && $a[$key] == $value) {
                return true;
            }
        }
        return false;
    }
948870
public static function set(array &$array, string $key, $value)
    {
        foreach (\explode('.', $key) as $k) {
            if (!isset($array[$k]) || !\is_array($array[$k])) {
                $array[$k] = [];
            }
            $array = &$array[$k];
        }

        $array = $value;
    }
1295212
public function getArrayValue(array $array, string $key)
    {
        foreach ($this->getBoth($key) as $loopKey) {
            if (array_key_exists($loopKey, $array)) {
                return $array[$loopKey];
            }
        }
    }
48021
protected function mutateAttributeForArray($key, $value)
    {
        $value = $this->mutateAttribute($key, $value);

        return $value instanceof Arrayable ? $value->toArray() : $value;
    }
835235
public function pluck($value, $key = null)
    {
        return new static(Arr::pluck($this->items, $value, $key));
    }
712016
public static function set( & $array, $key, $value)
	{
		if(is_null($key))
		{
			return $array = $value;
		}

		if(strpos($key, ".") !== false)
		{
			for( $i = 0, $keys = explode('.', $key), $count = count($keys); $i < $count; $i++ )
			{
				$key = $keys[$i];
				if( $i + 1 == $count )
				{
					break;
				}

				// If the key doesn't exist at this depth, we will just create an empty array
				// to hold the next value, allowing us to create the arrays to hold final
				// values at the correct depth. Then we'll keep digging into the array.
				if(! isset($array[$key]) || ! is_array($array[$key]))
				{
					$array[$key] = [];
				}

				$array = & $array[$key];
			}
		}

		$array[$key] = $value;

		return $array;
	}
14889
public function set(array $array, $keys, $value)
    {
        $keys = $this->parseKeys($keys);

        if ($keys) {
            $key = array_shift($keys);

            // This is the last key we've shifted
            if (!$keys) {
                $array[$key] = $value;
            } else {
                // There are more keys so this should be an array
                if (!isset($array[$key]) || !is_array($array[$key])) {
                    $array[$key] = array();
                }
                $array[$key] = $this->set(
                    $array[$key], $keys, $value
                );
            }
        }

        return $array;
    }
1311926
public function pluck(string $value, $key = null): Collection
    {
        $results = [];

        list($value, $key) = static::explodePluckParameters($value, $key);

        foreach ($this->items as $item) {
            $itemValue = self::dataGet($item, $value);

            if (is_null($key)) {
                $results[] = $itemValue;
            } else {
                $itemKey = self::dataGet($item, $key);
                $results[$itemKey] = $itemValue;
            }
        }

        return new static($results);
    }
754483
public static function set( &$array, $keys , $value ){
		$kArr = explode(".", $keys);
		$cursor = &$array;
		for( $i=0;$i<count( $kArr);$i++ ){
			$k = $kArr[$i];
			if( !isset($cursor[$k] )){
				//throw new \Exception("Undefined index '" . $k . "'");
				$cursor = null;
				break;
			}
			else{
				$cursor= &$cursor[$k];
			}
		}
		if( $cursor != null ){
			$cursor = $value;
			 
		}
		return $array;
	}
531044
public function pluck($value, $key = null): CollectionInterface
    {
        return $this->wrap(function (Iterator $data) use ($value, $key) {
            foreach ($data as $dataKey => $datum) {
                if ($key) {
                    yield $this->accessKey($datum, $key) => $this->accessKey($datum, $value);
                } else {
                    yield $this->accessKey($datum, $value);
                }
            }
        });
    }
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;
    }
150300
private function getArrayIndexByKeyValue($array, $value, $key = 'id')
    {
        foreach ($array as $index => $result) {
            if ($result[$key] === $value) {
                return $index;
            }
        }

        return false;
    }
775153
protected function getValue($key, array $array = array())
    {
        $keys = $this->parseKey($key);

        while (count($keys) > 0 and !is_null($array)) {
            $key = array_shift($keys);
            $array = isset($array[$key]) ? $array[$key] : null;
        }

        return $array;
    }