Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

order by array like sql php

$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);
 
PREVIOUS NEXT
Tagged: #order #array #sql #php
ADD COMMENT
Topic
Name
5+6 =