📜  按数组排序,如 sql php 代码示例

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

代码示例1
$id_group = array();
$id_group_pos = array();

// Obtain a list of columns
foreach ($product_list as $key => $row) {
  $id_group[$key]  = $row['id_group'];
  $id_group_pos[$key] = $row['id_group_pos'];
}

// Sort the product_list with id_group ascending then id_group_pos ascending
array_multisort($id_group, SORT_ASC, $id_group_pos, SORT_ASC, $product_list);