Re: Determine variable with the lowest value?
| From: | Jason Wong | Date: | Wed, 13 Oct 2004 22:26:03 +0000 |
| Subject: | Re: Determine variable with the lowest value? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-199446@lists.php.net to get a copy of this message | ||
On Thursday 14 October 2004 06:19, BOOT wrote:
[snip]
> I have been able to do this by means of if comparisons but the more I
> variables I add then the more complicated and messy it becomes. There has
> to be a simpler way. If it makes any difference, the variables could just
> as easily be array elements.
So stick them into an array and use one of the many array functions.
> the code should determine that $a and $b have the lowest value, and
> randomly pick one of them. if $a was = 1 instead then it would just pick $a
The "randomly pick one" part you would have to code yourself.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
It's amazing how much better you feel once you've given up hope.
*/