The Problem :
I have an array of data and every piece of data in this array is itself an array of data, for each element of the array I create a new object based on the data, for example :
...
class dynamic{
function dynamic($DATA){
$this->name=$DATA[0]
$this->value_1=$DATA[1]
$this->value_2=$DATA[2]
}
}
...
$DATA=array(array('testa',1,2),array('testb',2,1));
for($x=0;$x
$this->OBJECT[$x]=new dynamic($DATA[$x]);
}
...
Don't ask me why it's done like this and don't ask me to change it, this is the way it needs to be for the other classes to work.
Now, later on in another class I do a sort($this->OBJECT) and so far it will sort by 'name' ascending or descending, name being the first variable... If I change that to another variable I can order by that variable...
My question is simple... The answer, I fear, may be beyond the majority of Y!Answers users...
How do I define which variable to sort by and which sort function should I be using to do this..?
2006-12-21
03:29:07
·
1 answers
·
asked by
just_another_user
3