2
我有一個數組(如下)。我想按2個不同的值對它進行排序,首先是「覆蓋」中的值,它是一個1-9的整數。然後,如果0或null,我希望數組按「total_rank」進行排序。因此,如果覆蓋有3個不同的值213,然後總排名爲1.4,1.6,1.2,則數組將被重新組織爲具有覆蓋的行 - 1,2,3。下一行將是具有total_rank的行1.2,然後是1.4,1.6。在PHP中對多維數組排序2個不同的值
對不起,如果我沒有解釋清楚,我願意。我嘗試使用arsort(),但無法讓它做我想做的事(我是PHP新手)。
任何幫助,將不勝感激,多維數組的行的樣品低於:
array(16) {
["id"]=>
string(1) "3"
["title"]=>
string(5) "test2"
["description"]=>
string(5) "test2"
["requester"]=>
string(1) "1"
["project_id"]=>
string(1) "2"
["client_ranking"]=>
string(1) "5"
["tech_ranking"]=>
string(1) "5"
["time_ranking"]=>
string(1) "5"
["pm_ranking"]=>
string(1) "5"
["total_rank"]=>
string(3) "1.8"
["datecreated"]=>
string(19) "2012-01-05 11:58:13"
["dateclosed"]=>
string(19) "2012-01-05 11:58:13"
["ispending"]=>
string(1) "1"
["isclosed"]=>
string(1) "0"
["override"]=>
string(1) "5"
["developer"]=>
string(1) "1"
有你看在'array_multisort'? – topherg 2012-01-07 01:09:33
[由多個字段對多維數組排序]的Dup(http://stackoverflow.com/questions/2155117/),[在PHP中對多維數組排序](http://stackoverflow.com/questions/2059255/ ),[使用子鍵值對PHP數組排序](http://stackoverflow.com/questions/6570146/) – outis 2012-01-07 01:09:36
你能說清楚你想在這裏排序嗎?你會期望最終的結果是什麼?你有多少這些你想排序的數組? – deceze 2012-01-07 01:11:43