Added a new function to sort an associative array by key
This commit is contained in:
parent
c95f70dde7
commit
7ae97fa48b
|
@ -2362,4 +2362,12 @@ function set_unless_defined (&$var, $default) {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function sort_by_column (&$array_ref, $column) {
|
||||
if (!empty($column)) {
|
||||
usort($array_ref, function ($a, $b) {
|
||||
return strcmp($a[$column], $b[$column]);
|
||||
});
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue