Mojilo Mojilo - 1 month ago 5
PHP Question

array_intersect_key with three array in php

I have three array from dynamic data in php for example :

array1 = array('10-11-2015'=>23.6,
'25-11-2015'=>48.6,
'12-11-2015'=>14.52);

array2 = array('10-11-2015'=>8.7,
'22-10-2015'=>86.6,
'12-11-2015'=>78.5);

array3 = array('10-11-2015'=>5.8,
'19-09-2015'=>3.6,
'12-11-2015'=>96.4);


I just need common keys from this three array

newarray = array('10-11-2015','12-11-2015');


I use
array_intersect_key
but it is for only two array.

How I can get it form three or more array ?

Answer

Something like this?

array_keys(array_intersect_key($array1, $array2, $array3));
Comments