I have a multidimensional array and want to sort it by distance:
[clustermarkers] => [
0 => [
0 => [
'name' => 'A',
'distance' => 10
]
],
1 => [
0 => [
'name' => 'B',
'distance' => 8
]
],
...
];
I have tried usort function, but something wrong:
usort($clustermarkers, function($a, $b) {
return (int)$a['distance'] - (int)$b['distance'];
});