SammaySarkar wrote:Hiiiy, it's me with another wish!
PHP7's new combined comparison operator <=> can be pretty nice!Code: Select all
// operator <=> text compare(1, 2); text compare(4, 3); text compare(5, 5); function compare($a, $b) { return ($a > $b) ? 1 : ( ($a < $b) ? -1 : 0 ) ; }
XY already has a compare SC, so are you just suggesting the addition of the spaceship (<=>) operator?
Though, I suppose it's a bit more since compare() requires you to specify a method whereas this operator would presumably use the same logic as the existing comparison operators when deciding if the values are strings or numbers.
(Not a vote for or against just a pursuit for clarity.)