PHP combine two associative arrays into one array
问题 $array1 = array(\"$name1\" => \"$id1\"); $array2 = array(\"$name2\" => \"$id2\", \"$name3\" => \"$id3\"); I need a new array combining all together, i.e. it would be $array3 = array(\"$name1\" => \"$id1\", \"$name2\" => \"$id2\", \"$name3\" => \"$id3\"); What is the best way to do this? Sorry, I forgot, the ids will never match each other, but technically the names could, yet would not be likely, and they all need to be listed in one array. I looked at array_merge but wasn\'t sure if that was