i have an multidimensioanl array which can increase based on user input.i want to do array_intersect inside the array to get the common values between the key.
like example
Array ( [php] => Array ( [0] => 36 [1] => 51 [2] => 116 [3] => 171 [4] => 215 [5] => 219 [6] => 229 [7] => 247 [8] => 316 ) [java] => Array ( [0] => 14 [1] => 16 [2] => 19 [3] => 24 [4] => 25 [5] => 26 [6] => 29 [7] => 31 [8] => 33 [9] => 34 [10] => 35 [11] => 36 [12] => 37 [13] => 40 [14] => 45 [15] => 49 [16] => 51 ) )
expected output should be like (36,51)
and this is i am able to get it
via this,
$intersected_array = call_user_func_array('array_intersect', $array);
but if my array had a third key also which doesnot had a common value in all three of them
like
Array ( [php] => Array ( [0] => 36 [1] => 51 [2] => 116 [3] => 171 [4] => 215 [5] => 219 [6] => 229 [7] => 247 [8] => 316 ) [java] => Array ( [0] => 14 [1] => 16 [2] => 19 [3] => 24 [4] => 25 [5] => 26 [6] => 29 [7] => 31 [8] => 33 [9] => 34 [10] => 35 [11] => 36 [12] => 37 [13] => 40 [14] => 45 [15] => 49 [16] => 51 ) [ajax] => Array ( [0] => 91 [1] => 110 [2] => 113 [3] => 172 ) )
then it is throwing me output as the result of the key having max values. in this case it will return me all the values of java
key.
but my expected output is 0
. please help.