I have an array which looks like this:
$arr = ( [0]=>Int(2)
[1]=>Array( ....)
[2]=>Array( ....)
[3]=>Array( ....))
I have used usort to sort it:
usort($arr,function($a, $b) {
if($a['prop'] == $b['prop']) return 0;
return ($a['prop'] < $b['prop']) ? 1 : -1;
});
My problem is that the key [0] is rewritten with an Array element. Don’t get me wrong…it’s suppose to. How could i sort the $arr array without rewrite the key [0] ?
just use uasort()
http://php.net/manual/en/function.uasort.php