PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular

array_intersect

Tags: PHP 5.x PHP 7.x PHP 8.x

array_intersect — Computes the intersection of arrays.

Description

array_intersect(
    array $array,
array ...$arrays
): array
array_intersect() returns an array containing all the values of array that are present in all the arguments. Note that keys are preserved.

Parameters

array
The array with master values to check.
arrays
Arrays to compare values against.

Return Values

Returns an array containing all of the values in array whose values exist in all of the parameters.

array_intersect - New snippets