I need sort functions [function1(), function2(), function3()] in order of the values in array $numbers ($numbers[0], $numbers[1], $numbers[2]).
I only successfully sorted values $n1, $n2, $n3. But now I do not know how to sort functions below according these sorted values in array.
In this cause it means that first will be function3() next function1() and last function2(). And when I change values ($n1, $n2, $n3), order of functions will be automatically corrected.
$n1 = 50000;
$n2 = 100000;
$n3 = 25000;
$numbers = array($n1, $n2, $n3);
sort($numbers);
function function1() {
global $n1;
echo 'STANDARD';
echo '35 mil';
echo number_format($n1, 0, '', ' ');
}
function function2() {
global $n2;
echo 'STANDARD PLUS';
echo '70 mil';
echo number_format($n2, 0, '', ' ');
}
function function3() {
global $n3;
echo 'STANDARD PLUS';
echo '35 mil';
echo number_format($n3, 0, '', ' ');
}
Thanks in advance (Sorry - I am very beginner in programming)