I can't seem to see a pre-built functions but here is one I just wrote in
my email client:

function average($numberArray) {
    $sum = 0;
    for ($i=0;$i<count($numberArray);$i++)
       $sum += $numberArray[$i];
     return $sum / count($numberArray);
}

echo average(array (1,2,3,4,5));

Hope this helps :)
Andrew
----- Original Message -----
From: "JohnP" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 30, 2002 1:55 AM
Subject: [PHP] Average Number For Math Functions


Ok I looked at all the math functions for PHP but saw no way of returning
the average of a set of numbers - I plan on using this for a rating
system - any help?

--
John



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to