2021年2月11日星期四

How to average multiple arrays into one in PHP?

Lets say I have 4 arrays with the same amount of values in each:

$array1 = array(0, 7, 5, 0);  $array2 = array(2, 6, 10, 0);  $array3 = array(4, 8, 15, 10);  $array4 = array(6, 7, 20, 10);  

I want to count the average for all 4 of these arrays for each index. So I should get something like this:

array(3, 7, 12.5, 5);  
https://stackoverflow.com/questions/66160633/how-to-average-multiple-arrays-into-one-in-php February 12, 2021 at 02:27AM

没有评论:

发表评论