Sorting array of objects
| From: | Richard Harb | Date: | Mon, 05 Apr 2004 03:03:17 +0000 |
| Subject: | Sorting array of objects | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-182318@lists.php.net to get a copy of this message | ||
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?
The only way I thought I would be able to accomplish this is to
transform this into an assoc array or something like it and then sort
it ...
I found plenty of functions for dealing with plain arrays, but nothing
- easy to use - for this. Am I just blind or do I finally have to write
a function doing that on my own?
And if so - anyone who had to do this before and come up with a really
fast solution (I guess my attempts would work - but not very efficient)
Thanks
Richard