Thread: Sorting array
View Single Post
  #3  
Old 02-06-2007, 12:11 AM
Twizt3d Twizt3d is offline
Registered User
Join Date: Jul 2003
Posts: 15
Twizt3d is on a distinguished road
ok Ill give some more detail:

PHP Code:
this.firstarray = {"One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Eleven","Twelve","Thirteen"};

for (
temp.0temp.i<7temp.i++){
   
temp.random int(random(0,13));
   
this.secondarray.add(this.firstarray[temp.random]);
   
//some algorthm to sort the second array by the index's of the first array

this.secondarray will contain a random list of this.firstarray[] values. How could I put them in order. Example:

PHP Code:
this.secondarray = {"Two","Eleven","Three","Five","One","Twelve","Nine"}; 
Lets say the outcome of the for() made this.secondarray equal that.

How could I put this.secondarray in order from lowest to highest? So it will look like this:
PHP Code:
this.secondarray = {"One","Two","Three","Five","Nine","Eleven","Twelve"}; 
Reply With Quote