Re: sorting an array of objects
| From: | Matt McClanahan | Date: | Wed, 24 Oct 2001 19:04:34 +0000 |
| Subject: | Re: sorting an array of objects | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-72146@lists.php.net to get a copy of this message | ||
On Wed, Oct 24, 2001 at 10:43:53AM +0100, L Melville wrote:
> Is it possible to sort a class array using array multisort, I have two items
> in each class that I wish to sort by, one is a text and the other is the
> first item in an array within within each class. i.e.;-
>
> $class[$index]->text;
> $class[$index]->array[0];
>
> how can I do this?
I'd use usort() instead. http://www.php.net/manual/en/function.usort.php
The manual page has a couple examples for sorting objects by their member
variables.
Matt