php - Sort an array without rewriting a key -


i have array looks this:

$arr = ( [0]=>int(2)          [1]=>array( ....)          [2]=>array( ....)          [3]=>array( ....)) 

i have used usort sort it:

usort($arr,function($a, $b) { if($a['prop'] == $b['prop']) return 0;     return ($a['prop'] < $b['prop']) ? 1 : -1; }); 

my problem key [0] rewritten array element. don't me wrong...it's suppose to. how sort $arr array without rewrite key [0] ?

just use uasort()

http://php.net/manual/en/function.uasort.php


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -