src/Message/Server/UploadedFilesFactory.php
private function filesFlip(&$result, $keys, $value)
    {
        if (is_array($value)) {
            foreach ($value as $k => $v) {
                $newKeys = $keys;
                array_push($newKeys, $k);
                $this->filesFlip($result, $newKeys, $v);
            }
            return;
        }

        $res = $value;
        // Move the innermost key to the outer spot
        $first = array_shift($keys);
        array_push($keys, $first);
        foreach (array_reverse($keys) as $kk) {
            // You might think we'd say $res[$kk] = $res, but $res starts
            // out not as an array
            $res = array($kk => $res);
        }

        $result = $this->arrayMergeRecursive($result, $res);
    }
private function filesFlip(&$result, $keys, $value)
    {
        if (is_array($value)) {
            foreach ($value as $k => $v) {
                $newKeys = $keys;
                array_push($newKeys, $k);
                $this->filesFlip($result, $newKeys, $v);
            }
            return;
        }

        $res = $value;
        // Move the innermost key to the outer spot
        $first = array_shift($keys);
        array_push($keys, $first);
        foreach (array_reverse($keys) as $kk) {
            // You might think we'd say $res[$kk] = $res, but $res starts
            // out not as an array
            $res = array($kk => $res);
        }

        $result = $this->arrayMergeRecursive($result, $res);
    }
Move the innermost key to the outer spot

@param array  $result
@param array  $keys
@param mixed  $value