I have a multidimensional associative array of students ‘name’ and ‘time’:
Now, I want to find the average time for each student:
Output: `array:3 [▼
4 => array:4 [▼
0 => {#891 ▼
+“id”: 4
+“reftime”: “748”
+“user_names”: “Musiri muscifique”
}
3 => {#896 }
5 => {#900 }
9 => {#908 }
]
7 => array:5 []
6 => array:1 [▼
8 => {#907 ▼
+“id”: 6
+“reftime”: “748”
+“user_names”: “Bruno Gisa”
}
]
]
$arr = array();
foreach($Datas as $key => $item)
{
$arr[$item->id][$key] = $item;
}`
I would like to have the following result
$studentNames =['Musiri muscifique','John','AnnY'];
$studentAverageTimes =['540','210','200'];
Please how can get it?
Thanks