所以我有一个像这样的数组:
// user 1 $historia[id_usuario][id_historia]
$historia[1][1] = '1asdfasf';
$historia[1][8] = '1asdfasf';
$historia[1][7] = '1asdfasf';
$historia[1][4] = '1asdfasf';
// user 2 $historia[id_usuario][id_historia]
$historia[2][5] = '2asdfasf';
$historia[2][6] = '2asdfasf';
$historia[2][3] = '2asdfasf';
$historia[2][2] = '2asdfasf';
我需要让它们按第二个键排序,最终结果应该是这样的:
//person1
$historia[1][1] = '1asdfasf';
$historia[8][1] = '1asdfasf';
$historia[7][1] = '1asdfasf';
$historia[4][1] = '1asdfasf';
//person2
$historia[5][2] = '2asdfasf';
$historia[6][2] = '2asdfasf';
$historia[3][2] = '2asdfasf';
$historia[2][2] = '2asdfasf';
接着!
$historia[1][1] = '1asdfasf';
$historia[2][2] = '2asdfasf';
$historia[3][2] = '2asdfasf';
$historia[4][1] = '1asdfasf';
$historia[5][2] = '2asdfasf';
$historia[6][2] = '2asdfasf';
$historia[7][1] = '1asdfasf';
$historia[8][1] = '1asdfasf';
我试图阅读一些数组排序脚本,但我变得非常困惑,所以我实际上需要外部帮助......你们中的任何人都可以给我一个领导吗?
谢谢!