I have a PHP Array, and I want to extract from it the duplicated values and keep the corresponding keys for each value, in a new Array.
This is my starting Array
Array
(
[0] => ABC123-A
[1] => BG231-B
[2] => ABC123-A
[3] => BG231-E
[4] => BG231-F
[5] => BG231-G
[6] => BG231-H
[7] => ABC123-A
[8] => BG231-J
[9] => BG231-K
[10] => ABC123-A
)
And this is what I want to have:
Array
(
[0] => ABC123-A
[2] => ABC123-A
[7] => ABC123-A
[10] => ABC123-A
)
How can I do that ?
Thanks for help.
Test this out: