On Mon, Apr 05, 2004 at 05:03:17AM +0200, Richard Harb wrote:
> Hi there,
> 
> Supposed I have an array of objects, like:
> 
> $this[$i]->property1
> $this[$i]->property2
> 
> is there any 'cheap' way to sort the array according to the values of
> property1?
> 

Try array_multisort() ->

    // create a temporary array of just the property
    // you want to sort on...
    foreach ($array_of_objects as $k => $o)
        $temp[$k] = $o->property1;

    // sort
    array_multisort($temp, $array_of_objects);

- Rob

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to