Hi I am working on some array operations.
I need to convert first value of array as key and second value of array as value.
I have one variable $test
Assuming that structure will always be the same, you could do this:
$output = array();
foreach($testArray as $v){
$output[] = array($v[0] => $v[1]);
}
See it in action here.
Simple solution using array_map function:
$result = array_map(function($v){
return [$v[0] => $v[1]];
}, $testArray);