Let\'s assume I have an array of elements, which are arrays themselves, like so:
$array = [ [\'foo\' => \'ABC\', \'bar\' => \'DEF\'], [\'foo\'
You can also do it with array_reduce
$new_array = array_reduce($array, function($carry, $item) { $carry[$item['foo']] = $item; return $carry; }, []);