📜  php 按键对数组进行排序 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:38.535000             🧑  作者: Mango

代码示例3
$inventory = [
    ['price' => 10.99, 'product' => 'foo 1'],
    ['price' => 5.99, 'product' => 'foo 2'],
      ['price' => 100, 'product' => 'foo 3'],
  
];

$price = array_column($inventory, 'price');

array_multisort($price, SORT_DESC, $inventory);