📜  php 合并具有相同值的数组 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:52.290000             🧑  作者: Mango

代码示例3
function custom_array_merge(&$array1, &$array2) {
    $result = Array();
    foreach ($array1 as $key_1 => &$value_1) {
        // if($value['name'])
        foreach ($array2 as $key_1 => $value_2) {
            if($value_1['name'] ==  $value_2['name']) {
                $result[] = array_merge($value_1,$value_2);
            }
        }

    }
    return $result;
}