I need to merge Arrays into one Array and replace $key with $values of the same array.
My Array looks like this:
Array
(
[0] => Array
(
[city] => Berlin
)
[1] => Array
(
[city] => London
)
[2] => Array
(
[city] => New York
)
[3] => Array
(
[city] => Vienna
)
)
Desired result
Array
(
[Berlin] => Berlin
[London] => London
[New York] => New York
[Vienna] => Vienna
)
updates: source looks like this:
$a = json_decode('[{"city":"Berlin"},{"city":"London"},{"city":"New York"}, {"city":"Vienna"}]', true);```