Re: [PHP-DEV] array_intersect_key

2004-07-21 Thread Andrey Hristov
Andi Gutmans wrote: I suggest to make those #define's bit flags and then change: } else if (behavior == INTERSECT_ASSOC || behavior == INTERSECT_KEY) to (behavior & (INTERSECT|INTERSECT_KEY)) This idea came to my mind too. I have already commited a working version without bitflags but in the next d

Re: [PHP-DEV] array_intersect_key

2004-07-21 Thread Andrey Hristov
Cristiano Duarte wrote: Andrey Hristov wrote: Hallo Cristiano, these 2 function will be added to HEAD in few minutes. I see that the patch is kind of trivial and won't hurt anything :) (INTERSECT_KEY is just INTERSECT_ASSOC but no data comparison performed). I will add also array_diff_key() and a

Re: [PHP-DEV] array_intersect_key

2004-07-21 Thread Andi Gutmans
I suggest to make those #define's bit flags and then change: } else if (behavior == INTERSECT_ASSOC || behavior == INTERSECT_KEY) to (behavior & (INTERSECT|INTERSECT_KEY)) Change: #define INTERSECT_NORMAL 0 #define INTERSECT_ASSOC1 +#define INTERSECT_KEY

Re: [PHP-DEV] array_intersect_key

2004-07-21 Thread Andrey Hristov
Well, i think I have found a buggie (not related to these functions and I want to investigate it). Thus I will delay the commit. Cristiano Duarte wrote: Andrey Hristov wrote: Hallo Cristiano, these 2 function will be added to HEAD in few minutes. I see that the patch is kind of trivial and won't

Re: [PHP-DEV] array_intersect_key

2004-07-21 Thread Cristiano Duarte
Andrey Hristov wrote: > Hallo Cristiano, > these 2 function will be added to HEAD in few minutes. I see that the > patch is kind of trivial and won't hurt anything :) (INTERSECT_KEY > is just INTERSECT_ASSOC but no data comparison performed). > I will add also array_diff_key() and array_diff_uke

Re: [PHP-DEV] array_intersect_key

2004-07-21 Thread Cristiano Duarte
Andrey Hristov wrote: > Hallo Cristiano, > these 2 function will be added to HEAD in few minutes. I see that the > patch is kind of trivial and won't hurt anything :) (INTERSECT_KEY > is just INTERSECT_ASSOC but no data comparison performed). > I will add also array_diff_key() and array_diff_uke

Re: [PHP-DEV] array_intersect_key

2004-07-21 Thread Andrey Hristov
Hallo Cristiano, these 2 function will be added to HEAD in few minutes. I see that the patch is kind of trivial and won't hurt anything :) (INTERSECT_KEY is just INTERSECT_ASSOC but no data comparison performed). I will add also array_diff_key() and array_diff_ukey() cheers, andrey P.S. Andi: I th

Re: [PHP-DEV] array_intersect_key

2004-07-21 Thread Cristiano Duarte
Andrey Hristov wrote: > is "make test" showing problems? (i am just currious). > I will try to review the patch later today (atm i am sick). Nope. Make test shows the same errors before and after the patch. I decided to attach the patch since it will keep tabs... Cristiano Duarte --- array.c 200

Re: [PHP-DEV] array_intersect_key

2004-07-21 Thread Lukas Smith
Andrey Hristov wrote: is "make test" showing problems? (i am just currious). I will try to review the patch later today (atm i am sick). Which also reminds me that we still dont have a function to merge a multi dimensional array without messing with the array structures (which array_merge_recursi

Re: [PHP-DEV] array_intersect_key

2004-07-21 Thread Andrey Hristov
is "make test" showing problems? (i am just currious). I will try to review the patch later today (atm i am sick). andrey Cristiano Duarte wrote: Hi all, I needed to intersect an array with database records indexed by the primary key, with an array with keys and there is no php function that will d

Re: [PHP-DEV] array_intersect_key

2004-07-20 Thread Jason Garber
Hello Cristiano, First, I'd like to say that a function of this type sounds useful. It's one that I've wanted for some time, particularly for verifying that an array has the correct keys when it is passed as a function parameter. If I understand what you are doing correctly, the same

[PHP-DEV] array_intersect_key

2004-07-20 Thread Cristiano Duarte
Hi all, I needed to intersect an array with database records indexed by the primary key, with an array with keys and there is no php function that will do it internally. The database array looks like: $records = array ( 2587 => array('Name', 'Address', 'zip'), ...); And the array with PKS: $pks