← All built-ins / array_diff()

array_diff()

array_diff(...$args): mixed

Parameters

NameTypeDescription
$...arrayfirst the base array, then arrays of values to exclude

Return value

Values of the first array that appear in none of the others.

Example

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

See also

array_intersect()array_unique()