Merging of PHP two-dimensional arrays

merge arrays according to field seller_id
Array $result is as follows

Array
(
    [0] => Array
        (
            [seller_id] => 17140
            [bp_counts] => 1
        )

    [1] => Array
        (
            [seller_id] => 17140
            [dr_counts] => 9
        )
    [3] => Array
        (
            [seller_id] => 17140
            [dc_counts] => 10
        )
)

the desired array is

Array
(
    [0] => Array
        (
            [seller_id] => 17140
            [bp_counts] => 1
            [dr_counts] => 9
            [dc_counts] => 10
        )

)

ask the great god to help solve it, thank you.

Mar.22,2021

function field_merge($data, $field = 'seller_id') {
    $result = [];
    foreach ($data as $item) {
        if (!isset($result[$item[$field]])) {
            $result[$item[$field]] = [];
        }
        $result[$item[$field]] = array_merge($result[$item[$field]] ?: [], $item);
    }
    return array_values($result);
}

`
function field_merge ($data) {

foreach ($data as $v) {
    foreach ($v as $m => $n) {
        if(!isset($result[$m])){
            $result[$m] = $n;
        }
    }
}
$return[] = $result;
return $return;

}
`


$res = [];
foreach ($arr as $key = > $value) {

$res += $value;

}

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e4798e-44c25.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e4798e-44c25.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?