二維數據根據多個字段排序

array(26) {

	[0]=>

	array(3) {

	["name"]=>

	string(21) "學習支部"

	["jifen"]=>

	string(1) "3"

	["order_jifen"]=>

	string(3) "236"

	}

	[1]=>

	array(3) {

	["name"]=>

	string(27) "學校支部"

	["jifen"]=>

	string(2) "22"

	["order_jifen"]=>

	string(2) "60"

	}

	[2]=>

	array(3) {

	["name"]=>

	string(18) "未知人員支部"

	["jifen"]=>

	string(1) "1"

	["order_jifen"]=>

	int(0)

	}

	[3]=>

	array(3) {

	["name"]=>

	string(24) "測試黨支部"

	["jifen"]=>

	int(0)

	["order_jifen"]=>

	string(2) "19"

	}


	}

排序代碼以下: php

foreach ( $jifen as $key => $row ){
     $score[$key] = $row ['score'];
     $order_jifen[$key] = $row ['order_jifen'];
}
array_multisort($id, SORT_ASC, $age, SORT_DESC, $jifen );
print_r($jifen );
相關文章
相關標籤/搜索