logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Coding & Scripting Corner View previous topic :: View next topic
Reply to topic   Topic: [PHP][source] Sort multi array
Author
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Wed 26 Jul '06 14:10    Post subject: [PHP][source] Sort multi array Reply with quote

If some one from you need to sort an array like this

$ary_adps['arry_index_number']['adp_id']['vorname']['name']['url']['homepage']['strasse']['plz']['ort']['profil']['dist']['adresse'];
means
$ary_adps['adp_id']['vorname']['name']['url']['homepage']['strasse']['plz']['ort']['profil']['dist']['adresse'];
Sortieren will

Code:

function columnSort($unsorted, $column) {
   $sorted = $unsorted;
   for ($i=0; $i < sizeof($sorted)-1; $i++) {
     for ($j=0; $j<sizeof($sorted)-1-$i; $j++)
       if ($sorted[$j][$column] > $sorted[$j+1][$column]) {
         $tmp = $sorted[$j];
         $sorted[$j] = $sorted[$j+1];
         $sorted[$j+1] = $tmp;
     }
   }
   return $sorted;
}

$sorted=$ary_adps= columnSort($ary_adps, 'homepage');
Back to top


Reply to topic   Topic: [PHP][source] Sort multi array View previous topic :: View next topic
Post new topic   Forum Index -> Coding & Scripting Corner