Why use the min function? Just sort the array and then grab the first element in the sorted array. No random picking required.
E "Paul" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Thanks guys. Yes I figured using an array and the MIN function would be a > start. > > Now the random part..... > > > > > "Boot" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Any help with this would be appreciated. > > > > I am trying to come up with something that will find which variable(s) > have > > the lowest value and inidicate which variable this is. In the event that > > variables have an equally low value then it is to randomly pick one of the > > variables and idicate which this is. > > > > 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. > > > > example: > > > > $a = 2 > > $b =2 > > $c= 4 > > $d= 5 > > $e=6 > > $f =7 > > > > 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 > > > > > > Thanks for any suggestions! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php