Page 1 of 1

array(find average and median)

Posted: Tue Jan 09, 2007 3:47 am
by wonderaz
Hello....

I need to find out the average and median of the parameter array

I only manage to find the total of that array by using array_sum()
Can anyone please give me idea on how to create a function to solve my problem?

Thanks :)

Posted: Tue Jan 09, 2007 8:10 am
by feyd
count() and sort() will be used. Do you need further nudging?

Posted: Tue Jan 09, 2007 1:46 pm
by nickvd
Remember, the average is adding them all and dividing by the count, and the median is the "physical" location of the center point, or using interpolation, a value in between the middle two values... Finding the Quartiles/IQR would be done in the exact same matter.