in reply to comparing elements of two arrays

Can't see much wrong with that. The only thing I can think of is: are the array elements numbers, or are they strings?

If they're numbers, then of course it should be if ($array2[2] == $array1[2] ). If they're strings then you're doing it right.

andy.