There is a two-dimensional array obtained after parsing the page.

$reit[1][0]='text1'; $reit[1][1]='text2'; $reit[1][2]='text3'; $reit[1][3]='text4'; $reit[2][0]='7'; $reit[2][1]='1'; $reit[2][2]='1'; $reit[2][3]='2'; 

The task to sort, an array on the second column ... tried through array_multisort it is impossible ...

In the end should be:

 $reit[1][0]='text1'; $reit[1][1]='text4'; $reit[1][2]='text2'; $reit[1][3]='text1'; $reit[2][0]='7'; $reit[2][1]='2'; $reit[2][2]='1'; $reit[2][3]='1'; 
  • Something sorting logic is incomprehensible .. - Photon
  • Photon, these are key-value pairs. And the sorting is in the second array in descending order. Although it is true that before this you need to guess. - gecube


2 answers 2

here is the code

 array_multisort($reit[2],SORT_DESC,$reit[1]); 

prints here is.

 array(2) { [1]=> array(4) { [0]=> string(5) "text1" [1]=> string(5) "text4" [2]=> string(5) "text2" [3]=> string(5) "text3" } [2]=> array(4) { [0]=> string(1) "7" [1]=> string(1) "2" [2]=> string(1) "1" [3]=> string(1) "1" } } 

do you want that? because you have a mistake in the question for the campaign because I do not have the text3 element in the $ reit array [1]

    Like what you need http://www.php.net/manual/ru/function.krsort.php#55577