3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ "entry" => [ "name" => [ 37 => [ "file" => "my-file-test.docx", ], 38 => [ "file" => "resources_views.php", ], ], "type" => [ 37 => [ "file" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document", ], 38 => [ "file" => "application/x-php", ], ], "tmp_name" => [ 37 => [ "file" => "/tmp/phpahucFZ", ], 38 => [ "file" => "/tmp/phptnDGQR", ], ], "error" => [ 37 => [ "file" => 0, ], 38 => [ "file" => 0, ], ], "size" => [ 37 => [ "file" => 12023, ], 38 => [ "file" => 18174, ], ], ], ]; $result = []; foreach ($arr['entry'] as $key => $value) { foreach ($value as $key1 => $value1) { $result[$key1][$key] = $value1['file']; } } print_r($result); //reset index demo print_r(array_values($result));

preferences:
26.29 ms | 405 KiB | 5 Q