Created
June 28, 2022 14:17
-
-
Save mrmascott10/1dc1abd6e3adfcf89c1f94dcd12b341d to your computer and use it in GitHub Desktop.
Sort an associative array in PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ? Sort smallest first | |
usort($isochronesArr, function ($item1, $item2) { return $item2['mins'] <=> $item1['mins']; }); | |
// ? Sort largest first | |
usort($isochronesArr, function ($item1, $item2) { return $item1['mins'] <=> $item2['mins']; }); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment