我需要将 $array1 的数据结构转换为 $array2。我如何将属于相同 uid 和 title 的城市聚集在一起?
$array1 = [array("uid" => "29",
"title" => "Developer",
"city" => "Madrid"),
array("uid" => "29",
"title" => "Developer",
"city" => "Berlin"),
array("uid" => "29",
"title" => "Developer",
"city" => "London"),
array("uid" => "30",
"title" => "Designer",
"city" => "Amsterdam"),
];
$array2 = [array("title":"Developer",
"city" : ["Madrid","Berlin","London"]),
array("title":"Designer",
"city" : ["Amsterdam"])
];
Qyouu
慕田峪7331174