note 87252 added to book.array
| From: | Anonymous at osu1 dot php dot net | Date: | Wed, 26 Nov 2008 18:36:51 +0000 |
| Subject: | note 87252 added to book.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-146995@lists.php.net to get a copy of this message | ||
@jorge at andrade dot cl
This variant is faster:
<?php
function array_avg($array,$precision=2){
if(!is_array($array))
return 'ERROR in function array_avg(): this is a not array';
foreach($array as $value)
if(!is_numeric($value))
return 'ERROR in function array_avg(): the array contains one or more non-numeric
values';
$cuantos=count($array);
return round(array_sum($array)/$cuantos,$precision);
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 86.55.245.19
----
Manual Page -- http://www.php.net/manual/en/book.array.php
Edit -- https://master.php.net/note/edit/87252
Del: integrated -- https://master.php.net/note/delete/87252/integrated
Del: useless -- https://master.php.net/note/delete/87252/useless
Del: bad code -- https://master.php.net/note/delete/87252/bad+code
Del: spam -- https://master.php.net/note/delete/87252/spam
Del: non-english -- https://master.php.net/note/delete/87252/non-english
Del: in docs -- https://master.php.net/note/delete/87252/in+docs
Del: other reasons-- https://master.php.net/note/delete/87252
Reject -- https://master.php.net/note/reject/87252
Search -- https://master.php.net/manage/user-notes.php