Like already said, it is the array of arguments passed to the function. It's equivalent in PHP would be
The entire function would be
function variance() {
$sum = sum_squares(func_get_args());
$deg = func_num_args() - 1;
return $sum/$deg;
}
// echo variance(1,2,3,4,5); // 13.75 (55/4)
For sum_squares
, there is no native function in PHP. Assuming it does what the name implies, e.g. raising each argument to the power of 2 and then summing the result, you could implement it as
function sum_squares(array $args) {
return array_reduce(
$args, create_function('$x, $y', 'return $x+$y*$y;'), 0
);
}
// echo sum_squares( array(1,2,3,4,5) ); // 55
Replace create_function
with a proper lambda if you are on PHP5.3