旧数组:
$orders=array(
array(
"ordersn"=>'2019564842348',
"proName"=>'拖鞋',
"name"=>'张三',
"phone"=>"1800952442",
"proNum"=>2,
"proPrice"=>35.85
),
array(
"ordersn"=>'2019564842348',
"proName"=>'棉签',
"name"=>'张三',
"phone"=>"1800952442",
"proNum"=>1,
"proPrice"=>12
),
array(
"ordersn"=>'25451548412487',
"proName"=>'电脑',
"name"=>'李四',
"phone"=>"1564845487",
"proNum"=>1,
"proPrice"=>4600
),
);
如何通过相同的ordersn组装成新数组:
$orders=array( array( "ordersn"=>'2019564842348', "product"=>array( array( "proName"=>'拖鞋', "proNum"=>2, "proPrice"=>35.85 ), array( "proName"=>'棉签', "proNum"=>1, "proPrice"=>12 ), ), "name"=>'张三', "phone"=>'1800952442' ), array( "ordersn"=>'25451548412487', "product"=>array( array( "proName"=>'电脑', "proNum"=>1, "proPrice"=>4600 ), ), "name"=>'李四', "phpone"=>"1564845487", ), );