Array Sorting

8 entries

array_multisort Function Sorts multiple arrays jointly in the given order, keeping elements aligned across arrays. arsort Function Sorts an array in place descending by value while keeping key-value association. asort Function Sorts an array in place ascending by value while keeping key-value association. ksort Function Sorts an array in place ascending by key while keeping key-value association. natsort Function Natural order: digit segments compare by value (img2 < img10), text segments lexically; key-value bindings kept; natcasesort is the case-insensitive variant. rsort Function Sorts array elements in place in descending order. shuffle Function Shuffles array elements randomly (values kept, keys rebuilt as integers; associative keys lost); not cryptographically secure, seedability only via the global mt_srand. usort Function Sorts an array in place with a user-supplied comparison callback and rebuilds numeric indexes.