[PHP]Mean Average & Standard Deviation

For some stats revision I made these, you may like them,

For more information + source code go to the relevant link:
http://blog.digitalcarnival.com/2007/02/10/php-mean-average/
http://blog.digitalcarnival.com/2007/02/10/php-standard-deviation/

and previews:
http://php.digitalcarnival.com/meancalc.html
http://php.digitalcarnival.com/sdcalc.html

**FUNCTIONS:
**


function mean($x) {
$summation = 0;
$values = 0;
    foreach ($x as $value) {
        if (is_numeric($value)) {
            $total = $total + $value;
            $values++;
        }
    }
    $mean = $total/$values;
    return $mean;
}


function standard_deviation($x) {
$summation = 0;
$values = 0;
    foreach ($x as $value) {
        if (is_numeric($value)) {
            $summation = $summation + $value;
            $values++;
        }
    }
    $mean = $summation/$values;
    foreach ($x as $value) {
        if (is_numeric($value)) {
            $ex2 = $ex2 + ($value*$value);
        }
    }
    $rawsd = ($ex2/$values) - ($mean * $mean);
    $sd = sqrt($rawsd);
    return $sd;
}