[ create a new paste ] login | about

Link: http://codepad.org/0kza3RDS    [ raw code | output | fork ]

PHP, pasted on May 4:
1
2
3
4
5
6
7
8
9
10
11
<?php

    function harmonicMeanV2()
    {
    	$arguments = func_get_args();
    	$arguments = array_map('pow', $arguments, array_fill(0, count($arguments), -1));
    
    	return count($arguments) / array_sum($arguments);
    }

var_dump(harmonicMeanV2(40, 60), 48.0);


Output:
1
2
float(48)
float(48)


Create a new paste based on this one


Comments: