Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php sort by associative array value

//php 7+
usort($inventory, function ($item1, $item2) {
    return $item1['price'] <=> $item2['price'];
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #sort #associative #array
ADD COMMENT
Topic
Name
9+9 =