Computing an array’s average

Needing to calculate an array’s (composed of numeric values) average, I used the following function:

1
2
3
4
function array_average($a)
	{
	return array_sum($a) / sizeof($a);
	}

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Categories

Archives

Calendar

May 2018
M T W T F S S
« Jul    
 123456
78910111213
14151617181920
21222324252627
28293031