Given this array:
Array
(
[0] => Array
(
[id] => 3
[name] => aaa
)
[1] => Array
(
[id] => 2
[name] => bbb
)
[2] => Array
(
[id] => 3
[name] => aaa
)
[3] => Array
(
[id] => 1
[name] => ccc
)
[4] => Array
(
[id] => 3
[name] => aaa
)
)
How can I check if a value for a specific key is used more than once and return the key?
For example, I want to know which keys have the repeated "id" sub key. In this case id = 3 appears more than once so the result would be
Array
(
[0] => 2
[1] => 4
)
Notice that index 0 is not included because it's not actually repeated since is the first to appear.
idis in the second array. If it is not, add it. If it is, echo the index of the current item (or add that index to a 3rd array to create the array you're showing)2,3,4?