Last active
April 15, 2017 07:47
-
-
Save gaissa/c1c8f4ede8773dc8b002 to your computer and use it in GitHub Desktop.
sort array by value
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
private function sort_array_by_value(&$array, $subfield) | |
{ | |
$sortarray = array(); | |
foreach ($array as $key => $row) | |
{ | |
$sortarray[$key] = $row[$subfield]; | |
} | |
array_multisort($sortarray, SORT_ASC, $array); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment