php - Sort multi-dimensional array BUT do not reassign top-level keys -


array

$tagholder[$row['id']] = array(           "name" => $row['name'],         "primary" => $row['primary'],         "child" => $row['child'],         "order" => $row['order']      ); 

usort function

function sortasc($x, $y){ if ( $x['order'] == $y['order'] )  return 0; else if ( $x['order'] < $y['order'] )  return -1; else  return 1; } 

will order 'order' not keep original $row['id'] keys, instead reassigns first prosition 0 , on. how can make sort function sort keep $row['key'] untouched?

use uasort instead of usort keep key association.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -