Re: Make sorting stable

From: Date: Wed, 11 Mar 2020 22:26:22 +0000
Subject: Re: Make sorting stable
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-108989@lists.php.net to get a copy of this message
Hi Nikita! Nikita Popov wrote:
I've update the message to say:
Deprecated: usort(): Returning bool from comparison function is
deprecated, return an integer less than, equal to, or larger than zero in %s on line %d The astute reader will notice that this is equivalent to "any integer", but I think phrased this way, the meaning should be clear to anyone familiar with the basic concept of comparison functions, while not mentioning -1, 0 and 1 in particular.
Sounds good!
PS: Yes, I'm aware that you can also return a floating point number. No, you should definitely not do that, because it's going to get casted to an integer and produce wrong results if the numbers get large enough.
That sounds like something we could easily and cheaply fix… Regards, Andrea

« previous php.internals (#108989) next »