统计二维数组中某个值出现的次数
2021-01-20 23:14
标签:php column 统计 div period pre 次数 二维 isset 统计二维数组中某个值出现的次数 标签:php column 统计 div period pre 次数 二维 isset 原文地址:https://www.cnblogs.com/love1226/p/12899600.html$data =[
‘0‘ =>[
‘id‘ => 7,
‘patient_id‘ => 1,
‘arr1‘ => 高,
],
‘1‘ =>[
‘id‘ => 11,
‘patient_id‘ => 1,
‘arr1‘ => 低,
],
‘2‘ => [
‘id‘ => 13,
‘patient_id‘ => 1,
‘arr1‘ => 低,
]
];
解决:
$one[‘period‘]=isset(array_count_values(array_column($arr,‘policy_status‘))[0])?array_count_values(array_column($arr,‘policy_status‘))[0]:0;