function array_average($array) {
$retval = FALSE;
if(is_array($array) && count($array))
$retval = array_sum($array) / count($array);
return $retval;
}
$scores = array('R' => 8.5, 'Jan' => 9.8, 'Terry' => 8.0);
printf("There are %d scores, totaling %.2f and averaging %.2f.
",
count($scores), array_sum($scores), array_average($scores));
?>