On 7 May 2013 09:17, Thomas Anderson <zeln...@gmail.com> wrote: > It'd be nice if, when doing $objA > $objB, that that'd invoke > $objA->__compareTo($objB) or something, much like Java's Comparable > interface.
I wrote https://wiki.php.net/rfc/comparable a couple of years ago — there's a patch there that would probably still apply without too much work to master. About the only difference was that I didn't double underscore the magic method (in line with both Java and PHP interfaces like Countable). I ended up withdrawing it because the response at the time was somewhere between "meh" and "outright hostility"; I didn't see much point devoting time to something that was going to fail a vote regardless. It could be dusted off and reproposed for 5.6 if there was enough interest, but my guess is that it'd still be an uphill battle (even though some internal classes, most notably DateTime, do exactly this). Adam -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php