2

Possible Duplicate:
Return variable with the highest value?

I'm trying to come up with a simple way of finding the highest number out of 3 variables.

$1 = 100
$2 = 300
$3 = 200

out of those 3 variables, I want to set a new variable as the highest one ($2)

so:

$highest_number = 300
Community
  • 1
  • 1
Dylan Cross
  • 5,918
  • 22
  • 77
  • 118

1 Answers1

15
$highest_number = max($1, $2, $3);

OR

$values = array($1, $2, $3);
$highest_number = max($values);

Additional information can be found at the quickref for max

Matt Williamson
  • 39,165
  • 10
  • 64
  • 72