0
是否有一種簡單的方法來計算多維數組中的值的出現次數?多維數組中返回出現
我有以下數組:
array(
(int) 0 => array(
'HrEmployee' => array(
'id' => '7',
'surname' => 'Basson',
'name' => 'Andries'
),
'Setup' => array(
'color' => '004356',
'size' => 12
),
(int) 1 => array(
'HrEmployee' => array(
'id' => '25',
'surname' => 'Coetzee',
'name' => 'Zandereen',
),
'Setup' => array(
'color' => 'CFCFCF',
'size' => 8
),
(int) 2 => array(
'HrEmployee' => array(
'id' => '30',
'surname' => 'De Kock',
'name' => 'Theo',
),
'Setup' => array(
'color' => 'FFFFFF',
'size' => 12
),
(int) 3 => array(
'HrEmployee' => array(
'id' => '31',
'surname' => 'De Vaal',
'name' => 'Chantell',
),
'Setup' => array(
'color' => '00FF00',
'size' => 10
),
)
我想檢查的時候一定規模出現的量,所以它應該返回:
array(
(int) 8 => (int) 1,
(int) 10 => (int) 1,
(int) 12 => (int) 2
)
如何可以完成這個?
在我的經驗,你真的需要去深。在陣列上循環檢查'大小'並數它.. –