I have this array...
Array
(
[result] => Success
[finals] => Array
(
[0] => Array
(
[id] => 633
[name] => RESULT84
)
[0] => Array
(
[id] => 766
[name] => RESULT2
)
[0] => Array
(
[id] => 22
[name] => RESULT1
)
)
)
And I am extracting the names like this...
$names = array_column($data['finals'], 'name');
print_r($names);
Which gives me...
Array
(
[0] => RESULT84
[1] => RESULT2
[2] => RESULT1
)
My question is how can I modify it so that I get this...
Array
(
[RESULT84] => RESULT84
[RESULT2] => RESULT2
[RESULT1] => RESULT1
)
Is something like array_fill_keys my best bet?