Skip to content

Instantly share code, notes, and snippets.

@Pleiades
Created November 19, 2012 22:22

Revisions

  1. Pleiades created this gist Nov 19, 2012.
    15 changes: 15 additions & 0 deletions ppsc_array_sort.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    <?php
    function ppsc_array_sort (&$array, $key) {
    $sorter=array();
    $ret=array();
    reset($array);
    foreach ($array as $ii => $va) {
    $sorter[$ii]=$va[$key];
    }
    asort($sorter);
    foreach ($sorter as $ii => $va) {
    $ret[$ii]=$array[$ii];
    }
    $array=$ret;
    }
    ?>