array intersect
array_intersect(array $array, array ...$arrays): array
/* Returns an array containing all of the values in array whose
values exist in all of the parameters. */
array intersect
array_intersect(array $array, array ...$arrays): array
/* Returns an array containing all of the values in array whose
values exist in all of the parameters. */
php get intersection of two arrays
$array1 = [1, 2];
$array2 = [2, 3, 4];
$commonValue = array_intersect($array1, $array2);
//$commonValue = 2
// If you have X number of arrays you can do:
$array1 = [1, 2];
$array2 = [2, 3, 4];
$arrayOfArrays = [$array1, $array2];
$commonValue = array_intersect(...$arrayOfArrays);
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us