I checked other similar questions like php check array value for duplicate (which only gives a true or false result)
and How to detect duplicate values in PHP array? (which gets what values were duplicated, but not their keys it seems)
I have a need to look through the array and determine any duplicates for repeating to the end-user, including the array keys, so that I can echo those keys as "excel line numbers"
Sample Excel Spreadsheet:
E123456
E234567
E345678
E123456
E456789
E111111
E123456
E234567
E333333
E444444
Desired Result for end user:
E123456 was a duplicate, found on lines 1, 4, and 7
E234567 was a duplicate, found on lines 2 and 8
So I need to store both what value got duplicated AND the keys it was duplicated on.
I realize that this would be some combination of array_unique, array_diff, array_keys (and maybe a couple others), but I'm not sure what order to "stack" the calls in to get the desired result, without ending up with some brute-force method that causes the system to choke (the file size is potentially hundreds of lines)