Php groups and merges data based on a key value in a two-dimensional array

$data(0=>array(
            "city"=>"",
            "addressid"=>1,
            "ordersn"=>"456786a",
            "goods"=>""
        ),
        1=>array(
            "city"=>"",
            "addressid"=>1,
            "ordersn"=>"fdsdab",
            "goods"=>""
        ),
        2=>array(
            "city"=>"",
            "addressid"=>2,
            "ordersn"=>"fdasad",
            "goods"=>""
        ),
      );

grouped by addressid, the same addressid is merged into the same array, and change to the following

$data(0=>array(
            "city"=>"",
            "addressid"=>1,
            "ordersn"=>"456786a,fdsdab",
            "goods"=>","
        ),
        1=>array(
            "city"=>"",
            "addressid"=>2,
            "ordersn"=>"fdasad",
            "goods"=>""
        ),
      );
Mar.01,2021

$arr=array();
foreach($data as $k=>$v){
    $arr[$v['address']][]=$v;
}
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-1e369b6-43b5a.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-1e369b6-43b5a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?