I have a array like this:
$row_arr_1=array(7,9,5,10);
now I want to get the result array like this:
$row_arr_2=array(3,2,4,1);
Explanation:
As 10
is the largest value in row_arr_1
, then it will be replaced with value 1.
Similarly, as 9
is the 2nd highest value of row_arr_1
, then it will be replaced by 2 and so on.
I tried to sort the values of row_arr_1
but the position is changed.
How can i get my desired result?