<?php
$arr = [
"name" => [
"0" => "third.png",
"1" => "second.png",
"2" => "first.png",
],
"type" => [
"0" => "image/png",
"1" => "image/png",
"2" => "image/png",
],
"tmp_name" => [
"0" => "/opt/lampp/temp/phpOPmQcB",
"1" => "/opt/lampp/temp/phpk0j1yp",
"2" => "/opt/lampp/temp/phpS2mhVd",
],
"error" => [
"0" => 0,
"1" => 0,
"2" => 0,
],
"size" => [
"0" => 179440,
"1" => 102238,
"2" => 75915,
],
];
$keys = array_keys($arr);
$count = count($arr[$keys[0]]);
for($i = 0; $i<$count; $i++){
foreach($keys as $val){
$new[$i][$val] = $arr[$val][$i];
}
}
var_dump($new);
preferences:
47.52 ms | 405 KiB | 5 Q