Page 1 of 1

array comparison logic

Posted: Thu Feb 21, 2008 1:15 am
by controlxjp
hi guys,

hope to get a little bit of help with this

just thought anyone might have a better solution for this

i have 2 non numerically indexed arrays, with the same structure...
each record has a specific type determined in eg. column ['type'] and 5 types exist

what's the best way of comparing these two so that i can determine
if the records of type 1 differ in value /
if type 1 exists for array 1 /
if type 1 exists for array 2

currently i'm doing this

loop through all types

loop through array 1 and find the record of this type else, place null for array 1 var

loop through array 2 and find the record of this type else, place null for array 2 var


compare the temp variables
end loop

Re: array comparison logic

Posted: Thu Feb 21, 2008 2:16 am
by Christopher
Look through the array functions to see if there is one that will do what you want first:

http://www.php.net/manual/en/ref.array.php