Dear all,

I have to perform an intersection on array of arrays. The fact is that php does not support intersection on multidimensional arrays.

So, the first simple example using only one dimensional arrays works well:

$array1 = array("green", "red", "blue");
$array2 = array("green", "yellow", "red");
$array3 = array("green", "red", "purple");
$array4 = array("green","red","yellow");
$result = array_intersect($array1,$array2,$array3,$array4);
print_r($result);

And the result is: Array ( [0] => green [1] => red )

The question is how to perform intersection on the following structure:

$products = array(array("green","red","blue"),array("green","yellow","red"),array("green","red","purple"),array("green","red","yellow"));

Thanks in advance for any suggestions.

Best, Andrej

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to