I have an array like this in my scenario
$arr[0]['id']=1200;
$arr[0]['rate']=7.0;
$arr[1]['id']=1380;
$arr[1]['rate']=7.0;
$arr[2]['id']=1568;
$arr[2]['rate']=7.0;
$arr[3]['id']=1933;
$arr[3]['rate']=7.0;
when I sorted it using the usort as below, it reversed the order
usort($arr,function($a, $b) {
return $b['rate'] < $a['rate'];
});
[1933,1568,1380,1200]
but I want it to remain in the same order as it is inputted, if the rate
is same, as represented below
[1200,1380,1568,1933]
Please help, thanks in advance