我有以下数组,它们根据某些计算返回值:
print_r($adult_array);
print_r($children_array);
print_r($senior_array);
//Adult array start
Array
(
[0] => Array
(
[travel_plan] => Business
[premium_price] => 1336.81
[eligibility] => Up to 75 Yrs
[lower_limit] => 0
[upper_limit] => 75
[no_travellers] => 2
)
[1] => Array
(
[travel_plan] => Holiday
[premium_price] => 22960.81
[eligibility] => Up to 75 Yrs
[lower_limit] => 0
[upper_limit] => 75
[no_travellers] => 2
)
[2] => Array
(
[travel_plan] => Schengen
[premium_price] => 11740.81
[eligibility] => Up to 75 Yrs
[lower_limit] => 0
[upper_limit] => 75
[no_travellers] => 2
)
[3] => Array
(
[travel_plan] => Student
[premium_price] => 22960.81
[eligibility] => Up to 30 Yrs
[lower_limit] => 0
[upper_limit] => 30
[no_travellers] => 2
)
)
//Adult array end
//Children array start
Array
(
[0] => Array
(
[travel_plan] => Student
[premium_price] => 5740.205
[eligibility] => Up to 30 Yrs
[lower_limit] => 0
[upper_limit] => 30
[no_travellers] => 1
)
)
//Children array end
//Senior array start
Array
(
[0] => Array
(
[travel_plan] => Senior
[premium_price] => 38714.41
[eligibility] => 76 to 85 Yrs
[lower_limit] => 76
[upper_limit] => 85
[no_travellers] => 1
)
)
//Senior array end
上面的数组输出由不同的变量检索和保存。我想根据旅行计划合并/分组数组,同时总结所有类似旅行计划的保险费率。这样每个旅行计划只有一个数组,每个旅行计划的溢价总和。
一只斗牛犬
慕斯王