我有一系列这样的结果:
Array
(
[0] => Array
(
[product_code] => 1240605
[promo_level] => 2
[promo_type] => PCN
[free_value] => 20727.3
[disc_strata] => 20727.3
)
[1] => Array
(
[product_code] => 1330114
[promo_level] => 2
[promo_type] => PCN
[free_value] => 20727.3
[disc_strata] => 20727.3
)
[2] => Array
(
[product_code] => 1330115
[promo_level] => 2
[promo_type] => PCN
[free_value] => 20727.3
[disc_strata] => 20727.3
)
[3] => Array
(
[product_code] => 1240605
[promo_level] => 2
[promo_type] => PCN
[free_value] => 10472.64
[disc_strata] => 10472.64
)
[4] => Array
(
[product_code] => 1330114
[promo_level] => 2
[promo_type] => PCN
[free_value] => 10472.64
[disc_strata] => 10472.64
)
[5] => Array
(
[product_code] => 1330115
[promo_level] => 2
[promo_type] => PCN
[free_value] => 10472.64
[disc_strata] => 10472.64
)
[6] => Array
(
[product_code] => 1240605
[promo_level] => 2
[promo_type] => PCN
[free_value] => 2618.16
[disc_strata] => 2618.16
)
[7] => Array
(
[product_code] => 1330114
[promo_level] => 2
[promo_type] => PCN
[free_value] => 2618.16
[disc_strata] => 2618.16
)
[8] => Array
(
[product_code] => 1330115
[promo_level] => 2
[promo_type] => PCN
[free_value] => 2618.16
[disc_strata] => 2618.16
)
)
上面,有9个数组结果具有相同的 3个产品代码(1240605、1330114、1330115)
我想要这样的结果:
Array
(
[0] => Array
(
[product_code] => 1240605
[promo_level] => 2
[promo_type] => PCN
[free_value] => 33818.1
[disc_strata] => 33818.1
)
[1] => Array
(
[product_code] => 1330114
[promo_level] => 2
[promo_type] => PCN
[free_value] => 33818.1
[disc_strata] => 33818.1
)
[2] => Array
(
[product_code] => 1330115
[promo_level] => 2
[promo_type] => PCN
[free_value] => 33818.1
[disc_strata] => 33818.1
)
)
每次找到相同的产品代码时,都会添加自由值和光盘层。 希望有人可以提供帮助。