Re: [PHP] usort for sorting an array of objects

2008-12-10 Thread Robert Cummings
On Thu, 2008-12-11 at 11:44 +1300, German Geek wrote: > On Thu, Dec 11, 2008 at 6:43 AM, Robert Cummings <[EMAIL PROTECTED]>wrote: > > > On Thu, 2008-12-11 at 01:31 +1300, German Geek wrote: > > > On Wed, Dec 10, 2008 at 10:27 PM, Stut <[EMAIL PROTECTED]> wrote: > > > > > > > On 10 Dec 2008, at 04

Re: [PHP] usort for sorting an array of objects

2008-12-10 Thread German Geek
On Thu, Dec 11, 2008 at 12:28 PM, <[EMAIL PROTECTED]> wrote: > > > Inefficiency for me is when it takes longer to code. > > How long can this take? That's why i like PHP. It's very quick to do stuff in, even if arrays are not always the ultimate data structure, they're easy to handle with all the

Re: [PHP] usort for sorting an array of objects

2008-12-10 Thread ceo
> Inefficiency for me is when it takes longer to code. How long can this take? Even if you go full-blown with an Interface and static methods that have to be fleshed out in the implementations, you're still talking about an hour or so. Quit complaining and start typing. :-) > PHP is

Re: [PHP] usort for sorting an array of objects

2008-12-10 Thread Shiplu
PHP is a scripting language. Everytime the compiler has to parse the source. You can not except true OOP performance. OOP behavior is okay. If performance is the main factor, an C extension will do that. -- Blog: http://talk.cmyweb.net/ Follow me: http://twitter.com/shiplu -- PHP General Mailing

Re: [PHP] usort for sorting an array of objects

2008-12-10 Thread German Geek
On Thu, Dec 11, 2008 at 6:43 AM, Robert Cummings <[EMAIL PROTECTED]>wrote: > On Thu, 2008-12-11 at 01:31 +1300, German Geek wrote: > > On Wed, Dec 10, 2008 at 10:27 PM, Stut <[EMAIL PROTECTED]> wrote: > > > > > On 10 Dec 2008, at 04:15, German Geek wrote: > > > > > >> I need to sort an array of ob

Re: [PHP] usort for sorting an array of objects

2008-12-10 Thread ceo
You can use a (base) object Comparable with a method compareTo as the callback function for http://php.net/usort That gives you 99% of what you want, for the tiny price of having to pass in the array('Comparable','compareTo') as the callback arg. Given that one frequently calls usort and f

Re: [PHP] usort for sorting an array of objects

2008-12-10 Thread Shiplu
may be you can design a class. interface ISortable{ public sort(); public compare($a,$b); } SortableList implements ISortable { } -- Blog: http://talk.cmyweb.net/ Follow me: http://twitter.com/shiplu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/u

Re: [PHP] usort for sorting an array of objects

2008-12-10 Thread Robert Cummings
On Thu, 2008-12-11 at 01:31 +1300, German Geek wrote: > On Wed, Dec 10, 2008 at 10:27 PM, Stut <[EMAIL PROTECTED]> wrote: > > > On 10 Dec 2008, at 04:15, German Geek wrote: > > > >> I need to sort an array of objects. I found this ( at a url that didnt let > >> me send this msg... ) and I would kn

Re: [PHP] usort for sorting an array of objects

2008-12-10 Thread German Geek
On Wed, Dec 10, 2008 at 10:27 PM, Stut <[EMAIL PROTECTED]> wrote: > On 10 Dec 2008, at 04:15, German Geek wrote: > >> 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 e

Re: [PHP] usort for sorting an array of objects

2008-12-10 Thread Stut
On 10 Dec 2008, at 04:15, German Geek wrote: 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 Co

[PHP] usort for sorting an array of objects

2008-12-09 Thread German Geek
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 compa