sort associative array in php without build in function 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'];
});