RE: [PHP-WIN] Mathimatical equations in PHP
| From: | Asendorf, John | Date: | Fri, 28 Dec 2001 17:15:39 +0000 |
| Subject: | RE: [PHP-WIN] Mathimatical equations in PHP | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-11187@lists.php.net to get a copy of this message | ||
I agree, he is a bit on the edgy side... but he's also right. This is
simple math.
Here, I'll write you a function:
function average ( $array_numbers ) {
$total_numbers = count ( array_keys ( $array_numbers ) );
$sum = array_sum ( $array_numbers );
$average = $sum / $total_numbers;
return $average;
}
$numbers = array ( 1 , 5 , 7 , 8 , 10 , 14 , 3 , 2 , 5 , 2 , 7 );
$average = average ( $numbers );
echo $average;
---------------------
John Asendorf - jasendorf@lcounty.com
Web Applications Developer
http://www.lcounty.com - NEW FEATURES ADDED DAILY!
Licking County, Ohio, USA
740-349-3631
Nullum magnum ingenium sine mixtura dementiae fuit
> -----Original Message-----
> From: Todd Williamsen [mailto:todd@williamsen.net]
> Sent: Friday, December 28, 2001 11:44 AM
> To: php-windows@lists.php.net
> Subject: Re: [PHP-WIN] Mathimatical equations in PHP
>
>
> BAT..
>
> you need to get that stick out of your ass, you are annoying
> and no help to
> people that needs it
>
> "B.A.T. Svensson" <B.A.T.Svensson@lumc.nl> wrote in message
> news:27E647E5629ED211BF78009027289C6302157DC5@mail1...
> > Don't send CC message to those who does not need the information,
> > pleeeeeeeeeeeeeeeese!!!
> >
> > (I am starting to get pretty fucking annoyed about that
> people doesn't
> check
> > those things before pressing the send button/key.)
> >
> > >-----Original Message-----
> > >From: Mike Flynn [mailto:mike@mikeflynn.net]
> > >Sent: Friday, December 28, 2001 5:32 PM
> > >To: Svensson, B.A.T. (HKG); php-windows@lists.php.net
> > >Subject: RE: [PHP-WIN] Mathimatical equations in PHP
> > >
> > >
> > >Huh? To average? You just use addition and division. It
> > >doesn't require
> > >a function. A function would not only be silly but
> probably take more
> > >keystrokes just to type.
> > >
> > >Average = sum of units' values / number of units.
> > >
> > >Additionally, you can do this automatically if you're storing
> > >your values
> > >in a database such as MySQL, using built-in functions.
> See the MySQL
> > >manual (www.mysql.com) or whatever database for more on this.
> > >
> > >-Mike
> > >
> > >At 05:11 PM 12/28/2001 +0100, Svensson, B.A.T. (HKG) wrote:
> > >>I am kind of pessimistic by nature, and would not with out
> > >having checked
> > >>out this thing believe the case is not in you favor this time.
> > >>
> > >> /Anders
> > >>
> > >> >-----Original Message-----
> > >> >From: Todd Williamsen [mailto:todd@williamsen.net]
> > >> >Sent: Friday, December 28, 2001 5:04 PM
> > >> >To: php-windows@lists.php.net
> > >> >Subject: Re: [PHP-WIN] Mathimatical equations in PHP
> > >> >
> > >> >
> > >> >That is not what I was looking for, is there a function in PHP
> > >> >that does this?
> > >> >
> > >
> > >
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
> For additional commands, e-mail: php-windows-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>