Hey Nikita, > On 2 Feb 2015, at 13:49, Nikita Popov <nikita....@gmail.com> wrote: > > I've voted -1 because I think this should be a function and not an operator. > compare($a, $b) is more obvious than $a <=> $b and it's not like writing > comparison functions is such a super common use case that it needs the extra > brevity of an operator. A function can furthermore be used as a callback, > while an operator requires a wrapping closure.
There’s no actual use for the bare comparison operation as a callback, though: usort($foo, ‘compare’); would just be a slow version of sort($foo); I agree that having it be available as a function might be useful in some cases, but this is also true of most operators. I think it would be better to add some means of obtaining a closure for PHP’s operators, however. Thanks. -- Andrea Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php