public static function extract($collection, $value, $key = null, $default = null)
    {
        $results = [];

        [$value, $key] = static::extractKeyValueParameters($value, $key);

        foreach ($collection as $item) {
            $itemValue = static::walk($item, $value, $default);

            if (is_null($key)) {
                $results[] = $itemValue;
            } else {
                $itemKey = static::walk($item, $key, $default);

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

        return $results;
    }
public static function extract($collection, $value, $key = null, $default = null)
    {
        $results = [];

        [$value, $key] = static::extractKeyValueParameters($value, $key);

        foreach ($collection as $item) {
            $itemValue = static::walk($item, $value, $default);

            if (is_null($key)) {
                $results[] = $itemValue;
            } else {
                $itemKey = static::walk($item, $key, $default);

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

        return $results;
    }
public static function extract ( $ collection , $ value , $ key = null , $ default = null ) { $ results = [ ] ; [ $ value , $ key ] = static :: extractKeyValueParameters ( $ value , $ key ) ; foreach ( $ collection as $ item ) { $ itemValue = static :: walk ( $ item , $ value , $ default ) ; if ( is_null ( $ key ) ) { $ results [ ] = $ itemValue ; } else { $ itemKey = static :: walk ( $ item , $ key , $ default ) ; $ results [ $ itemKey ] = $ itemValue ; } } return $ results ; }
Extracts values from a Collection, array or set of objects

@param array|Collection  $collection
@param string|array      $value
@param string|array|null $key
@param mixed|null        $default

@return array
Extracts values from a Collection array or set of objects