Hi,

Larry Garfield wrote:
If I'm understanding the definition of stable here, it means that if two values 
evaluate to equal they will always end up in the same order in the output that 
they were in the input, yes?  So (trivial example):

$a = ["3", 2, 3, 5];

Sorts to:

[2, "3", 3, 5];

always, whereas right now it may sort to that or to [2, 3, "3", 5], somewhat 
randomly.  Am I understanding correctly?

(That is _my_ understanding, though I'd take Nikita's word for it rather than mine.)

I think you indirectly point out a good reason to have a stable sorting algorithm for PHP: PHP's weird type-juggling equality rules mean several kinds of values that are not really (===) equal will compare equal (==) so far as sorting cares, which probably means messy results sometimes when paired with an unstable sort?

Thanks,
Andrea

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

Reply via email to