Re: [PHP] array_intersect question

2008-12-10 Thread German Geek
On Tue, Dec 2, 2008 at 11:06 PM, Andrej Kastrin <[EMAIL PROTECTED]>wrote: > It works like a charm. > > Thanks, Andrej > > Tim | iHostNZ wrote: > >> I know there must be a more elegant way with array_reduce or something, >> but >> I would simply write a function called >> >> function array_intersec

Re: [PHP] array_intersect question

2008-12-02 Thread Andrej Kastrin
It works like a charm. Thanks, Andrej Tim | iHostNZ wrote: I know there must be a more elegant way with array_reduce or something, but I would simply write a function called function array_intersect_m($m_array) { $intersection = $m_array[0]; for ($i=1; $i < count($m_array); $i++) { $in

Re: [PHP] array_intersect question

2008-12-02 Thread Tim | iHostNZ
I know there must be a more elegant way with array_reduce or something, but I would simply write a function called function array_intersect_m($m_array) { $intersection = $m_array[0]; for ($i=1; $i < count($m_array); $i++) { $intersection = array_intersect($m_array[$i], $intersection); }

Re: [PHP] array_intersect question

2008-12-02 Thread Yeti
> 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")); If I understood you correctly .. -- PHP General Mailing List (http://www.php