What is the best way to remove duplicate entries from an array in PHP, while excluding specific values?

When removing duplicate entries from an array in PHP, we can use the `array_unique()` function. However, to exclude specific values from being removed, we can first filter out those values using `array_filter()` and then apply `array_unique()` to the filtered array.

// Original array with duplicate and specific values
$array = [1, 2, 3, 2, 4, 5, 3, 6];
$specificValues = [2, 4];

// Filter out specific values
$array = array_filter($array, function($value) use ($specificValues) {
    return !in_array($value, $specificValues);
});

// Remove duplicate entries
$array = array_unique($array);

print_r($array);