usort changing Array's order
问题 I have a usort function with a single line: return 0. I tried to use it on an Array of stdClass objects, and it changes their order, how is that possible? 回答1: The property you assume is called stability: A stable sorting algorithm will not change the order of elements that are equal. php's sorting functions are not stable (because non-stable sorts may be slightly faster). From the documentation of usort: If two members compare as equal, their order in the sorted array is undefined. If you