Created
February 11, 2014 17:07
-
-
Save fdask/8939261 to your computer and use it in GitHub Desktop.
PHP - Sort multi-dimensional array by value
This file contains hidden or 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
| // call this | |
| usort($myArray, function($a, $b) { | |
| return $a['order'] - $b['order']; | |
| }); | |
| // ends up sorting in reverse order, or | |
| $myArray = array_reverse($myArray); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment