php - Sort array by value then key -
this question has answer here: php array multiple sort - value key? 9 answers i'm using asort sort simple array: $arr = array('a'=>30, 'b'=>12, 'k'=>23, 'x'=>1, 'h'=>11, 't'=>1, 'u'=1); asort($arr) yields array ( [a] => 30 [k] => 23 [b] => 12 [h] => 11 [x] => 1 [t] => 1 [z] => 1 ) is there native way sort value and key in 1 call (while preserving key/value relationship)? for example, i'm wanting results end this: array ( [a] => 30 [k] => 23 [b] => 12 [h] => 11 [t] => 1 [x] => 1 [z] => 1 ) native function not, there ways easily php array multiple sort - value key?