Question:
My doubt is the following? I have the following array:
$array1 = array(10, 50, 80, 40, 90);
$array2 = array(10, 30, 10, 40, 20);
$array3 = array(10, 60, 15, 40, 30);
$array4 = array(20, 30, 40, 10, 50);
$array5 = array(10, 05, 10, 90, 40);
I would like to know if there is a simple way to go through all and return only the values that are repeated in all arrays.
To get duplicate values from the same array I'm using:
$unArray = array_unique( array_diff_assoc( $idCliArray, array_unique( $idCliArray ) ) )
Now I need to know how to catch only what is repeated in everyone.
Answer:
You can use array_intersect function, example:
$array1 = array(10, 50, 80, 40, 90);
$array2 = array(10, 30, 10, 40, 20);
$array3 = array(10, 60, 15, 40, 30);
$array4 = array(20, 30, 40, 10, 50);
$array5 = array(10, 05, 10, 90, 40);
$values = array_intersect($array1,$array2,$array3,$array4,$array5);