let's suppos we have the following two arrays
Let's suppose this is called $array1
Array
(
[0] => Array
(
[Name] => Jack
[Height] => 190
[Shoe Size] => 40
)
[1] => Array
(
[Name] => Rose
[Height] => 160
[Shoe Size] => 52
)
)
Suppose this is called $array2
Array
(
[0] => Name
[1] => Shoe Size
)
Now, what I need to do, is to keep the keys in $array1 which are found in $array2 as values, so the output I'm expecting is something like this
Array
(
[0] => Array
(
[Name] => Jack
[Shoe Size] => 40
)
[1] => Array
(
[Name] => Rose
[Shoe Size] => 52
)
)
I tried array_intersect and array_intersect_key but they're both failing. does anyone have any idea how to do this?