Merging arrays based on a value of the key
问题 I have two arrays of arrays that have an id key, and I'd like to merge the data together based on that array's key and key value. The data would look something like: $color = [ ['id' => 1, 'color' => 'red'], ['id' => 2, 'color' => 'green'], ['id' => 3, 'color' => 'blue'], ]; $size = [ ['id' => 1, 'size' => 'SM'], ['id' => 2, 'size' => 'XL'], ['id' => 3, 'size' => 'MD'], ['id' => 4, 'size' => 'LG'], ]; $combined = [ ['id' => 1, 'color' => 'red', 'size' => 'SM'], ['id' => 2, 'color' => 'green',