×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Lori DK
Added: Nov 10, 2016 7:49 PM
Modified: Nov 10, 2016 8:00 PM
Views: 18
Tags: array php sort
  1. function aasort (&$array, $key) {
  2.             $sorter=array();
  3.             $ret=array();
  4.             reset($array);
  5.             foreach ($array as $ii => $va) {
  6.                 $sorter[$ii]=$va[$key];
  7.             }
  8.             asort($sorter);
  9.             foreach ($sorter as $ii => $va) {
  10.                 $ret[$ii]=$array[$ii];
  11.             }
  12.             $array=$ret;
  13.         }
  14.  
  15.         aasort($show_listings,"title");