← All built-ins / array_intersect()
array_intersect()
array_intersect(...$args): mixed
Parameters
| Name | Type | Description |
|---|---|---|
| $... | array | first the base array, then arrays to intersect with |
Return value
Values of the first array that appear in all the others.
Example
echo implode(",", array_intersect([1, 2, 3, 4], [2, 4, 5]));2,4