I have 8 variables, e.g. $a, $b, $c, $d, $e, $f, $g, $h with various values (they change every time the PHP script runs). I need to put that list in descending order according to the numerical value of the variables -- but the final result needs to be a string listing the variables by name.
For example, if
$a = 2 $b = 9 $c = 4 $d = 0 $e = 3 $f = 8 $g = 7 $h = 1 then the resulting output should be a string like this: $string = "$b $f $g $c $e $a $h $d"
What is a good, efficient way to do that? I have a feeling it would involve putting the names and the values of the variables into a two-dimensional array, then sorting using array_multisort() . Would an expert like to show me how? Thanks.