Home >Backend Development >PHP Tutorial > php计算优惠信息 求计算算法 多谢
php计算优惠信息 求计算算法 谢谢
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ -->$arr=array('item_info_list' => Array ( '0' => Array ( 'sku_id' => '1003244250', 'ware_id' => '1001418658', 'jd_price' => '269.00', 'sku_name' => '百事PEPSI 男式板鞋 2012新款夏季透气舒适男款经典休闲板鞋 猎人绿 40', 'outer_sku_id' => '40872121106', 'product_no' => '872121101 872121102 872121104 872121105', 'gift_point' => '0', 'item_total' => '1', ) , '1' => Array ( 'sku_id' => '1003244255', 'ware_id' => '1001418658', 'jd_price' => '269.00', 'sku_name' => '百事PEPSI 男式板鞋 2012新款夏季透气舒适男款经典休闲板鞋 暗红 39', 'outer_sku_id' => '39872121105', 'product_no' => '872121101 872121102 872121104 872121105', 'gift_point' => '0', 'item_total' => '1', ) ) , 'coupon_detail_list' => Array ( '0' => Array ( 'order_id' => '213978711', 'sku_id' => '1003244250', 'coupon_type' => '30-单品促销优惠', 'coupon_price' => '170.00', ) , '1' => Array ( 'order_id' => '213978711', 'sku_id' => '1003244255', 'coupon_type' => '30-单品促销优惠', 'coupon_price' => '170.00', ) ) )
foreach ($arr['item_info_list'] as $key=>$val) { if(isset($arr['coupon_detail_list'][$key])) $arr['item_info_list'][$key] = array_merge($val, $arr['coupon_detail_list'][$key]); } print_r($arr); <div class="clear"> </div>