Hi Guys,

I need to sort an array of objects. I found this ( at a url that didnt let
me send this msg... ) and I would know how to do it, but I believe there
might be a cleaner, more elegant way to do it. In Java, you just need to
implement the interface Comparable and provide a method called compareTo (as
far as i remember) and then you can use one of the many sorting algorithms
generically on objects that are comparable...

Anyway, I didn't find something like that for PHP. Since I'm using symfony,
I had a bit of a play with the objects at hand and simply did a
sort($arrayOfObjects) and it did sort them by the id. Just wondering where
it got the information on what to sort on (not quite) correctly for my case?

Thanks for your interest.

-- 
Tim-Hinnerk Heuer

http://www.ihostnz.com -- Web Design, Hosting and free Linux Support

Reply via email to