Friday, 15 March 2013

php - krsort for for arrays with INTs as an index -



php - krsort for for arrays with INTs as an index -

i have array looks this:

array ( [2] => 2 [3] => 2 [1] => 1 )

i want sort array integers in descending order

array ( [3] => 2 [2] => 2 [1] => 1 )

is there php function can that, tried krsort, think works on strings outputted "1".

thanks

krsort right changes array (pass reference), not returns new one.

krsort($a); print_r($a);

php arrays

No comments:

Post a Comment