Is there a PHP function to arrange numbers from max to min.?

suppose i have

$val_1 = 100;
$val_2 = 250;
$val_3 = 180;
$val_4 = 150;

is there a function to arrange them in order from max value to min value?

$arr_position = array();

$arr_position[0] = $val_2;
$arr_position[1] = $val_3;
$arr_position[2] = $val_4;
$arr_position[3] = $val_1;

where $arr_position[0] stores max values, and then follow on…

Just add them to an array, then sort the array however you wish using the built-in functions. :slight_smile:

which built in function are u referring?

I didn’t refer to any function.

The manual would be a good start.

rsort()