$array = [
['key1' => 10, 'key2' => 'wang'],
['key1' => 2, 'key2' => 'WANG'],
['key1' => 30, 'key2' => 'king'],
['key1' => 34, 'key2' => 'KING'],
['key1' => 301, 'key2' => 'kING'],
['key1' => 20, 'key2' => 'King'],
['key1' => 400, 'key2' => 'Wang'],
['key1' => 400, 'key2' => 'ABCDEFG'],
['key1' => 400, 'key2' => 'ABCDEFg'],
['key1' => 400, 'key2' => 'AbcDEFG'],
['key1' => 400, 'key2' => 'AbcdEFG'],
['key1' => 400, 'key2' => 'Bacdefg'],
];
¬
function asc_sort($a, $b) {
if($a['key1'] > $b['key1']) {
return true;¬
} else if($a['key1'] < $b['key1']) {
return false;
} else {
return 0;
}
}
function asc_name_sort($a, $b) {
return strcmp($a['key2'], $b['key2']);
}
//usort($array, 'asc_sort');
usort($array, 'asc_name_sort');
var_dump($array);