Php Count Duplicates In Arraylist Api