Re: [RFC] Comparable: the revenge

From: Date: Fri, 20 Feb 2015 10:23:38 +0000
Subject: Re: [RFC] Comparable: the revenge
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-83285@lists.php.net to get a copy of this message
On 19.02.15 22:40, Adam Harvey wrote: > Those of you with long memories will remember that I proposed a > Comparable interface way back in the pre-5.4 days, but withdrew it > when it became obvious that there was no consensus for it as a feature > and that a vote was likely to fail. > > RFC: https://wiki.php.net/rfc/comparable > PR: https://github.com/php/php-src/pull/1097 Afaik \DateTime object already implement a way to be used with <,>,etc. but they don't use an interface for that. $ php -r '$past = new DateTime("-1 month"); $future = new DateTime("+1 month"); var_dump($past < $future);' bool(true) $ php -r '$past = new DateTime("-1 month"); $future = new DateTime("+1 month"); var_dump($past > $future);' bool(false) Shouldn't they retroactively be adopted to that? Extend from that Interface, implement a compoareTo? - Markus

« previous php.internals (#83285) next »