Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php sort multidimensional array by key

function buildSorter($key) {
    return function ($a, $b) use ($key) {
        return strnatcmp($a[$key], $b[$key]);
    };
}

usort($array, buildSorter('key_b'));
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #sort #multidimensional #array #key
ADD COMMENT
Topic
Name
4+1 =