PHP二维数组按照其中一列从大到小排序array_multisort 函数的使用

$list = $createStraegyService->selectStock('riskIndustry/getIndusListByCode', 'get', $param);
foreach($list as $k=>$val){
    $arr[] =    array('industryCode'=>$val['industryCode'],'positions_score'=>$val['positionsScore']);
}

$tags_count = array_column($arr,'positions_score');
array_multisort($tags_count,SORT_ASC,$arr);

foreach($arr as $value){
    $newArr[$value['industryCode']] = $value['positions_score'];
}

foreach ($newArr as $industry_code=>$value) {
    $newStockCodes[] = $industry_code;
}
$stock_codes_str = implode(",", $newStockCodes);

你可能感兴趣的:(php)