Array_unique will not give you that information, it will only delete the duplicates.
If you count the values with array_count_values then use array_diff to get what is not 1, then the code will return the duplicated items.
But it will return them in keys, so use array_keys to get them as values.
$input = ['a', 'a', 'b'];
$count = array_count_values($input);
$duplicated = array_keys(array_diff($count, [1]));
var_export($duplicated);
https://3v4l.org/2HS8e
You can also echo the duplicates with:
echo implode(", ", $duplicated);