How can I find the match of the key of an array in another array?
For instance,
array 1,
Array
(
[0] => Array
(
[parent_id] => 4 // the lookup key
[count] => 7
)
[1] => Array
(
[parent_id] => 5 // the lookup key
[count] => 2
)
)
array 2,
Array
(
[0] => Array
(
[router] => xxx
[path] => xxx
[plugin] => xxx
)
[1] => Array
(
[router] => xxx
[path] => xxx
[plugin] => xxx
[parent_id] => 4 // the match
)
[2] => Array
(
[router] => xxx
[path] => xxx
[plugin] => xxx
)
[3] => Array
(
[router] => xxx
[path] => xxx
[plugin] => xxx
[parent_id] => 5 // the match
)
[4] => Array
(
[router] => xxx
[path] => xxx
[plugin] => xxx
)
)
result that I am after,
Array
(
[0] => Array
(
[router] => xxx
[path] => xxx
[plugin] => xxx
[parent_id] => 4
[count] => 7
)
[1] => Array
(
[router] => xxx
[path] => xxx
[plugin] => xxx
[parent_id] => 5
[count] => 2
)
)
Turn array 1 into an associative array where the parent ID is the key.but not sure about the second part -...adding the corresponding count to each element.can you show an example please?