the following array wid and gid are the same, requiring Num accumulation, different operations are directly displayed, how to achieve array deduplication?
$arr = array(
array(
"wid" => 1,
"gid" => 3,
"num" => 4,
),
array(
"wid" => 2,
"gid" => 1,
"num" => 4,
),
array(
"wid" => 1,
"gid" => 3,
"num" => 3,
),
array(
"wid" => 2,
"gid" => 1,
"num" => 4,
),
array(
"wid" => 1,
"gid" => 1,
"num" => 4,
),
);
here are the effects I want
$arr = array(
array(
"wid" => 1,
"gid" => 3,
"num" => 7,
),
array(
"wid" => 2,
"gid" => 1,
"num" => 8,
),
array(
"wid" => 1,
"gid" => 1,
"num" => 4,
),
);