我有这个数组
[furnitures] => Array
(
[0] => Array
(
[fi_id] => 8
[price] => 15.00
)
[1] => Array
(
[fi_id] => 8
[price] => 15.00
)
[2] => Array
(
[fi_id] => 7
[price] => 15.00
)
[3] => Array
(
[fi_id] => 7
[price] => 15.00
)
[4] => Array
(
[fi_id] => 8
[price] => 15.00
)
[5] => Array
(
[fi_id] => 9
[price] => 15.00
)
)
我想从中获得独特的fi_id,我也想从中计算出来。这个代表了多少次。 PHP有内置函数吗?
像独特的项目一样,7,8,9和7代表2次,8代表3次,9代表1次。
答案 0 :(得分:1)
你可以试试这个:
export function personnelReducer(state = initialState, action: PersonnelActions.PersonnelActions) {
..........
}