I have an sorted array which contains first names of people.
This array has lots of names which are same.
I want to output only duplicate names.
Example,
input array:
Array
(
[0] => Abbas
[1] => Abhay
[2] => Abhinav
[3] => Abhishek
[4] => Aditya
[5] => Ahmed
[6] => Ahmed
[7] => Ajay
[8] => Ajay
}
It should return
Array
(
[5] => Ahmed
[6] => Ahmed
[7] => Ajay
[8] => Ajay
}
Use this code:
It will return unique duplicates but if you want non-unique duplicates then use:
EDIT: Based on your comments, try this code:
OUTPUT