企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# php数组函数 -- array\_column,array\_multisort 实现二维数组排序 ~~~ $a = array( array( 'id' => 5698, 'key' => 'Bill', 'value' => '1', ), array( 'id' => 4767, 'key' => 'Steve', 'value' => '0', ), array( 'id' => 3809, 'key' => 'Mark', 'value' => '2', ) ); // 看第一张图 $values = array_column($a,'value'); //按照某个字段对二维数组排序 array_multisort($values,SORT_DESC,$a); print_r($a);exit; ~~~ ### 输出: ``` Array ( [0] => Array ( [id] => 3809 [key] => Mark [value] => 2 ) [1] => Array ( [id] => 5698 [key] => Bill [value] => 1 ) [2] => Array ( [id] => 4767 [key] => Steve [value] => 0 ) ) ```