Well, if the array was passed in from somewhere else and is usually more
than one element, why would you clutter up your code checking every
time for the one-element (or no element) case rather than assuming
sort correctly handles all cases.
(just for the records) :)
*sorting* works in any case!!! according to the manual sorting actually is ok. the documentation says *nothing* about the keys (de facto, if you would weigh this behaviour against the documentation you would not be able to find a bug anyhow) it just is a kind of inconsistency. you only can treat this a bug looking at the C code, where a parameter for "renumbering" is given (renumbering is 0 for key-preserving sorting)
the current behaviour simply isn't defined and thus follows: you can infer anything from a wrong premise! inferring this being correct behaviour is equally legitimate inferring the contrary!
actually I think treating this as a bug makes sense, but this should not go in before 4.1 to avoid any confusion.
andré
--
· André Langhorst t: +49 331 5811560 ·
· andre@php.net m: +49 173 9558736 ·
* PHP Quality Assurance http://qa.php.net *