Merging arrays based on a value of the key

前端 未结 9 1311
予麋鹿
予麋鹿 2020-12-19 09:03

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 somethin

9条回答
  •  抹茶落季
    2020-12-19 09:39

    Folllow this: array_replace_recursive() is recursive : it will recurse into arrays and apply the same process to the inner value.

    $combined = array_replace_recursive($color, $size);
    

    then you can print to see the result as bellow:

    print_r($combined);
    

提交回复
热议问题