Re: Make sorting stable
| From: | Andrea Faulds | Date: | Thu, 05 Mar 2020 23:58:21 +0000 |
| Subject: | Re: Make sorting stable | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-108880@lists.php.net to get a copy of this message | ||
Hi,
Nikita Popov wrote:
I've implemented this variant now. If the comparison function returns a boolean, you getI think that message could be a little misleading, because any negative or positive value is valid, not just those of magnitude 1, right? IIRC strcmp($a, $b) doesn't just return -1 and 1, and of course this is also the case for the classic ($a - $b). Thanks, AndreaDeprecated: usort(): Returning bool from comparison function isdeprecated, return one of -1, 0 or 1 instead in %s on line %d once per usort() call, and we retry with swapped operands to ensure compatibility. Regards, Nikita