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_intersect_m($m_array) {

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); }

[PHP] array_intersect question

2008-12-02 Thread Andrej Kastrin
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);

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++) {

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 $arr = array(); $arr[] = array(green, red, blue); $arr[] =

[PHP] array_intersect problem

2006-12-25 Thread Leo Liu
Hi, I try to intersect associative array and it seems to fail to do so. Can anyone show me a walk around? For example I have array1 Array ( [0] = Array ( [imageID] = 1 ) [1] = Array ( [imageID] = 2 ) [2]

Re: [PHP] array_intersect problem

2006-12-25 Thread Martin Alterisio
2006/12/25, Leo Liu [EMAIL PROTECTED]: Hi, I try to intersect associative array and it seems to fail to do so. Can anyone show me a walk around? For example I have array1 Array ( [0] = Array ( [imageID] = 1 ) [1] = Array (

[PHP] array_intersect()

2003-07-01 Thread Shena Delian O'Brien
Is this function still broken in php 4.3.0+? The manual says it was broken in PHP 4.0.4. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] array_intersect()

2001-01-19 Thread Chris Lee
Ok I thought array_intersect() was the function I was looking for, I might have to write my own. I want an array with ONLY the keys/values that are present in all the variables; ie. ? $test_a[] = '974806802083190501'; $test_a[] = '974806802083190503'; $test_a[] =

Re: [PHP] array_intersect()

2001-01-19 Thread Chris Lee
ok, Ive got my code to work, but its a big jerry-rig haha. because I am using mtime() (the last two chars are allways 00) I substr the last two chars off, array_insersect() them, then add 00 the the end of all the values in the result array. dumb eh. Chris Lee Mediawaveonline.com "Chris Lee"