我有一个 UNSORTED VERSION 类型的数组。
$arr['foo']['man'] = 5;
$arr['foo']['str'] = 'string5';
$arr['foobar']['man'] = 2;
$arr['foobar']['str'] = 'string2';
$arr['barfoo']['man'] = 4;
$arr['barfoo']['str'] = 'string4';
$arr['foofoo']['man'] = 1;
$arr['foofoo']['str'] = 'string1';
$arr['bar']['man'] = 3;
$arr['bar']['str'] = 'string3';
我想按降序对它进行排序,同时保留该数组中的所有其他数据,即
$arr['foo']['man'] = 5;
$arr['foo']['str'] = 'string5';
$arr['barfoo']['man'] = 4;
$arr['barfoo']['str'] = 'string4';
$arr['bar']['man'] = 3;
$arr['bar']['str'] = 'string3';
$arr['foobar']['man'] = 2;
$arr['foobar']['str'] = 'string2';
$arr['foofoo']['man'] = 1;
$arr['foofoo']['str'] = 'string1';
我查看了 PHP 中的许多排序函数,但没有找到任何解决方案。
有谁能够帮助我?提前致谢。