I have this kind of array :
<?php
$arr = [ 0 => [ ... ],
1 => [ 0 => 'one',
1 => 'two',
2 => 'three',
...
],
2 => [ ... ],
3 => [ 0 => 'guy',
1 => 'brush',
2 => 'threepwood',
...
]
];
What could be the most reduced line of code to get :
$newArr = [
'one' => 'guy',
'two' => 'brush',
'three' => 'threepwood',
...
];
?
$arr[1]
and $arr[3]
has the same number of elements of course.
if $arr[0]
and $arr[2]
do not matter, then just iterate and place the first set's value as the second set's key as such:
foreach($arr[1] as $k => $v){
$newArr[$v] = $arr[3][$k];
}
print_r($newArr);
or something like this:
$newArr = array_combine($arr[1], $arr[3]);