Hi, Ian!
I've already posted a thread in response to another similar question. What you need to do is find PHP sorting algorithm implementations like quicksort, shellsort, bubblesort - on planetsourcecode.com, for instance. Each of them have their own tradeoffs, for instance quicksort is very effective for almost sorted arrays.
After that you need to create a comparison function which will compare two objects. You may extend this function so that it could sort objects by any member variable.
It can look like this
function compare_obj($obj1, $obj2, $var)
{
if ($obj1->$var == $obj2->$var) return 0;
return ($obj1->$var < $obj2->$var ? -1 : 1);
}
Then, in the sorting function, just replace the standard comparison function with this one. The $var can be put as the last parameter to the sorting function itself and then passed to the comparison function so you could sort by any member variable.
Hope this helps,
Stas