1
我想這應該是smple,但我一直堅持這一段時間,所以我需要幫助。我有一個CakePHP程序,我得到下面的數組:CakePHP使用返回的數組值
chratSortedMean= array(
'totalAucFourHour' => array(
'Screening Visit-1 (scr)' => array(
'MmttFourthHour' => array(
'totalAucs' => array(
(int) 0 => (float) 0,
(int) 1 => (float) 220
)
)
),
'Month12' => array(
'MmttFourthHour' => array(
'totalAucs' => array(
(int) 0 => (float) 263.25,
(int) 1 => (float) 16.25
)
)
)
),
'totalAucTwoHour' => array(
'Day0' => array(
'MmttSecondHour' => array(
'totalAucs' => array(
(int) 0 => (float) 0,
(int) 1 => (float) 112.125
)
)
),
'DayD2' => array(
'MmttSecondHour' => array(
'totalAucs' => array(
(int) 0 => (float) 97.375,
(int) 1 => (float) 4.5
)
)
),
'Month3' => array(
'MmttSecondHour' => array(
'totalAucs' => array(
(int) 0 => (float) 8.53125,
(int) 1 => (float) 8.75
)
)
)
)
)
我要計算每個時間點的totalAucs值的平均值(篩選拜訪-1(SCR),Month12,Day0等)分別爲總AucFourHour和totalAucTwoHour單獨。
所以我要的結果是有些下面的形式:
'totalAucFourHour' => array(
'Screening Visit-1 (scr)' => array(
'MmttFourthHour' => array(
'totalAucMean' => (float) 110
)
)
),
'Month12' => array(
'MmttFourthHour' => array(
'totalAucMean' => (float) 139.75
)
)
)
),
等。我不希望使用多個for循環,因爲我預計數據將來會增長。