public static function filesFlip(&$result, $keys, $value)
    {
        if (is_array($value)) {
            foreach ($value as $k => $v) {
                $newKeys = $keys;
                array_push($newKeys, $k);
                self::filesFlip($result, $newKeys, $v);
            }
        } else {
            $res = $value;
            // Move the innermost key to the outer spot
            $first = array_shift($keys);
            array_push($keys, $first);
            foreach (array_reverse($keys) as $k) {
                // You might think we'd say $res[$k] = $res, but $res starts out not as an array
                $res = [$k => $res];
            }

            $result = array_replace_recursive($result, $res);
        }
    }
public static function filesFlip(&$result, $keys, $value)
    {
        if (is_array($value)) {
            foreach ($value as $k => $v) {
                $newKeys = $keys;
                array_push($newKeys, $k);
                self::filesFlip($result, $newKeys, $v);
            }
        } else {
            $res = $value;
            // Move the innermost key to the outer spot
            $first = array_shift($keys);
            array_push($keys, $first);
            foreach (array_reverse($keys) as $k) {
                // You might think we'd say $res[$k] = $res, but $res starts out not as an array
                $res = [$k => $res];
            }

            $result = array_replace_recursive($result, $res);
        }
    }
public static function filesFlip ( & $ result , $ keys , $ value ) { if ( is_array ( $ value ) ) { foreach ( $ value as $ k => $ v ) { $ newKeys = $ keys ; array_push ( $ newKeys , $ k ) ; self :: filesFlip ( $ result , $ newKeys , $ v ) ; } } else { $ res = $ value ; // Move the innermost key to the outer spot $ first = array_shift ( $ keys ) ; array_push ( $ keys , $ first ) ; foreach ( array_reverse ( $ keys ) as $ k ) { // You might think we'd say $res[$k] = $res, but $res starts out not as an array $ res = [ $ k => $ res ] ; } $ result = array_replace_recursive ( $ result , $ res ) ; } }
Flips the file's array keys.

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

@return void

@author Bart Kelsey <http://www.opengameart.org>
@see    https://stackoverflow.com/questions/5444827/how-do-you-loop-through-files-array/29664753#29664753
Flips the file s array keys .