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

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to