(PHP) sorting an array on a specific value


Simple way to sort an array with usort on a specific value using a comparator.

[php]
usort($myArray, function ($a, $b) {
return $a[‘foo’] > $b[‘foo’];
});
[/php]

Leave a Reply

Your email address will not be published. Required fields are marked *