note 101727 added to function.array-sum
| From: | uhehesh at gmail dot com | Date: | Fri, 07 Jan 2011 10:21:39 +0000 |
| Subject: | note 101727 added to function.array-sum | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-175510@lists.php.net to get a copy of this message | ||
<?php
function avrg()
{
$count = func_num_args();
$args = func_get_args();
return (array_sum($args) / $count);
}
?>
This function calculates average of numbers given as arguments. Examples:
avrg(100, 200, 300) - returns 200.
avrg(5, 6) - returns 5.5.
avrg('foo') - returns 0.
----
Server IP: 69.147.83.197
Probable Submitter: 93.80.215.111
----
Manual Page -- http://www.php.net/manual/en/function.array-sum.php
Edit -- https://master.php.net/note/edit/101727
Del: integrated -- https://master.php.net/note/delete/101727/integrated
Del: useless -- https://master.php.net/note/delete/101727/useless
Del: bad code -- https://master.php.net/note/delete/101727/bad+code
Del: spam -- https://master.php.net/note/delete/101727/spam
Del: non-english -- https://master.php.net/note/delete/101727/non-english
Del: in docs -- https://master.php.net/note/delete/101727/in+docs
Del: other reasons-- https://master.php.net/note/delete/101727
Reject -- https://master.php.net/note/reject/101727
Search -- https://master.php.net/manage/user-notes.php