rugzo Posted August 26, 2009 Share Posted August 26, 2009 Hi all, i couldn't find expression for average. There are many of them like sum(array) max(array) but couldn't find something like avg(array) ? Link to comment https://forums.phpfreaks.com/topic/171942-array-average/ Share on other sites More sharing options...
Mark Baker Posted August 26, 2009 Share Posted August 26, 2009 Simple math, asuuming by average you mean mean $average = array_sum($array) / count($array); Link to comment https://forums.phpfreaks.com/topic/171942-array-average/#findComment-906629 Share on other sites More sharing options...
waterssaz Posted August 26, 2009 Share Posted August 26, 2009 function average($array) { return array_sum($array) / count($array); } Works out the mean. Link to comment https://forums.phpfreaks.com/topic/171942-array-average/#findComment-906630 Share on other sites More sharing options...
rugzo Posted August 26, 2009 Author Share Posted August 26, 2009 thanks... Link to comment https://forums.phpfreaks.com/topic/171942-array-average/#findComment-906637 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.