public static function fetch($array, $key)
    {
        $results = [];

        foreach (explode('.', $key) as $segment)
        {
            foreach ($array as $value)
            {
                if (array_key_exists($segment, $value = (array) $value))
                {
                    $results[] = $value[$segment];
                }
            }

            $array = array_values($results);
        }

        return array_values($results);
    }
public static function fetch($array, $key)
    {
        $results = [];

        foreach (explode('.', $key) as $segment)
        {
            foreach ($array as $value)
            {
                if (array_key_exists($segment, $value = (array) $value))
                {
                    $results[] = $value[$segment];
                }
            }

            $array = array_values($results);
        }

        return array_values($results);
    }
public static function fetch ( $ array , $ key ) { $ results = [ ] ; foreach ( explode ( '.' , $ key ) as $ segment ) { foreach ( $ array as $ value ) { if ( array_key_exists ( $ segment , $ value = ( array ) $ value ) ) { $ results [ ] = $ value [ $ segment ] ; } } $ array = array_values ( $ results ) ; } return array_values ( $ results ) ; }
Fetch a flattened array of a nested array element.

@param  array  $array
@param  string $key

@return array
Fetch a flattened array of a nested array element .