php sort associative array by key descending code example
Example: php sort by associative array value
//php 7+
usort($inventory, function ($item1, $item2) {
return $item1['price'] <=> $item2['price'];
});
//php 7+
usort($inventory, function ($item1, $item2) {
return $item1['price'] <=> $item2['price'];
});