It would pay attention to both keys and values even if values would be arrays as well. One important note is that if value of $primary_array is yet another array, its order of key & value pairs becomes important for matching.