天天看点

PHP二维数组根据键值降序排序

$modelData = [
			[
				'modelName' => '华为',
				'num' => 2
			], [
				'modelName' => '小米',
				'num' => 5
			], [
				'modelName' => '苹果',
				'num' => 1
			]
		];
array_multisort(array_column($modelData, 'num'), SORT_DESC, $modelData);