update array intersection function to handle associative keys