← All built-ins / array_unique()

array_unique()

array_unique(array $a): mixed

Parameters

NameTypeDescription
$aarrayinput array

Return value

The array without duplicate values (first occurrence wins).

Example

echo implode(",", array_unique([1, 2, 2, 3, 1]));
1,2,3

See also

array_values()array_diff()