I have two arrays that I want to combine. I need to take values ββfrom the first array, use these values ββas keys for matching with the second array and combine them into a third array (the one that I will use).
In other words, I have this first array:
Array
(
[24] => 5
[26] => 4
[27] => 2
)
My second array:
Array
(
[1] => McDonalds
[2] => Burger King
[3] => Wendys
[4] => Taco Bell
[5] => Hardees
)
And finally, this is the array I want to have:
Array
(
[5] => Hardees
[4] => Taco Bell
[2] => Burger King
)
It seems easy enough, but I can't figure it out. I tried various array functions, such as array_intersect_key, with no luck.
source
share