just a simple function that will get the average of numbers that you picked...
Useage: $numbers = "1 4 9 10 4 8"; average($numbers);
and will return the average of them numbers ;)
<?php
// For those that don't like using explode
function average($numbers) {
$a = split(' ', $numbers);
foreach ($a as $b) { $c = $c + $b; $d++; }
return number_format($c/$d,0);
}
// For those that like using explode
function average($numbers) {
$a = explode(' ', $numbers);
$d = count($a);
for ($i=$d;$i;$i--) { $c = $c + $a[$i]; }
return number_format($c/$d,0);
}
?>