1<?php
2/**
3 Examples of these functions:
4 array_unique,
5 array_diff_assoc,
6 array_diff,
7 array_keys,
8 array_intersect
9
10 Examle with an array:
11*/
12$array = array('a', 'a', 'b', 'c', 'd');
13
14// Unique values
15$unique = array_unique($array);
16
17// Duplicates
18$duplicates = array_diff_assoc($array, $unique);
19
20// Unique values
21$result = array_diff($unique, $duplicates);
22
23// Get the unique keys
24$unique_keys = array_keys($result);
25
26// Get duplicate keys
27$duplicate_keys = array_keys(array_intersect($array, $duplicates));
28