Re: sorting object props
| From: | Richard Lynch | Date: | Sat, 18 Jun 2005 20:54:43 +0000 |
| Subject: | Re: sorting object props | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-217186@lists.php.net to get a copy of this message | ||
On Fri, June 17, 2005 2:48 pm, D_C said:
> is there a way to sort the properties of an object by their name, much
> like sort works on arrays?
>
> i am getting back an object from a database query and want to list the
> resulting items in alpha order by field name...
http://php.net/ksort
Last time I checked, PHP would still convert an object to an array if you
forced it to...
If not, there are introspective functions to examine your object and all
its properties, and surely you could build the array yourself and then
ksort it.
--
Like Music?
http://l-i-e.com/artists.htm