Fw: [PHP] greater than question
| From: | Matt Grimm | Date: | Tue, 27 May 2003 20:52:14 +0000 |
| Subject: | Fw: [PHP] greater than question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-149168@lists.php.net to get a copy of this message | ||
You could put the vars into an array, and use the max fcn:
$limit = max($varArray);
foreach($varArray as $value) {
if ($value == $limit) {
// run something
}
}
--
Matt Grimm
Web Developer
The Health TV Channel, Inc.
(a non - profit organization)
3820 Lake Otis Parkway
Anchorage, AK 99508
907.770.6200 ext. 686
907.336.6205 (fax)
E-mail: mgrimm@healthtvchannel.org
Web: www.healthtvchannel.org
> ----- Original Message -----
> From: "Steve Buehler" <steve@ibapp.com>
> To: "PHP" <php-general@lists.php.net>
> Sent: Tuesday, May 27, 2003 11:45 AM
> Subject: [PHP] greater than question
>
>
> > Hopefully someone has done this and has an easy answer. I know that I
can
> > do what I need with a LOT of code, but am trying to come up with
something
> > a little shorter that 50 lines of code. Here is the problem. I have 4
> > variables that each have a number in them. I need to find which one has
> > the highest number. I then just need to do something with that number.
> If
> > two or more have the same "highest" number, than I need to do the same
> > thing with them. So......
> > $a=5
> > $b=1
> > $c=5
> > $d=3
> >
> > $a and $c are the highest number. I need to run something on those two
> > variables.
> >
> > Thanks in Advance
> > Steve
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>