Arr.php
public static function fetch(array $array, string $key, string $delimiter = null) : array
    {
        // Results holder.
        $results = [];

        // Which string delimiter should we use?
        if (null === $delimiter) {
            $delimiter = static::$delimiter;
        }

        foreach (explode($delimiter, $key) as $segment) {
            $results = [];

            foreach ($array as $value) {
                $value = (array) $value;

                $results[] = $value[$segment];
            }

            $array = array_values($results);
        }

        return array_values($results);
    }
public static function fetch(array $array, string $key, string $delimiter = null) : array
    {
        // Results holder.
        $results = [];

        // Which string delimiter should we use?
        if (null === $delimiter) {
            $delimiter = static::$delimiter;
        }

        foreach (explode($delimiter, $key) as $segment) {
            $results = [];

            foreach ($array as $value) {
                $value = (array) $value;

                $results[] = $value[$segment];
            }

            $array = array_values($results);
        }

        return array_values($results);
    }
public static function fetch ( array $ array , string $ key , string $ delimiter = null ) : array { // Results holder. $ results = [ ] ; // Which string delimiter should we use? if ( null === $ delimiter ) { $ delimiter = static :: $ delimiter ; } foreach ( explode ( $ delimiter , $ key ) as $ segment ) { $ results = [ ] ; foreach ( $ array as $ value ) { $ value = ( array ) $ value ; $ results [ ] = $ value [ $ segment ] ; } $ array = array_values ( $ results ) ; } return array_values ( $ results ) ; }
Fetches a flattened array of an element nested in the initial array.

@param   array   $array      The initial array.
@param   string  $key        The string delimited key.
@param   string  $delimiter  The delimiter to use when exploding the key into parts.
@return  array               The resulting array.
Fetches a flattened array of an element nested in the initial array .