Return variable with the highest value?

2020-04-08 11:36发布

问题:

I have 3 variables: $num1, $num2, and $num3. Each represent the number of rows a table column has.

I want to find which variable has the highest variable, so I can use it in a for loop (shown below)

for ( $row = 1; $row <= $HIGHEST_VARIABLE; $row++) {
     ...
}

This probably was already answered, but I can't find it based on my searches

回答1:

$highest = max($num1, $num2, $num3);