This paper illustrates the use of sort, asort and ksort in the sequence of PHP arrays for reference. The specific examples are as follows:
||$arr = Array (' d ' => ' SDF ', ' R ' => ' SDF ', ' a ' => ' eee ');
||Sort ($arr); Rearrange the values of the array, delete the previous key value, and become an indexed array
||Asort ($arr); The array is rearrange by value and the index relationship is maintained, and both the indexed and associative arrays apply
||Ksort ($arr); The array of arrays is queued according to the key value and the index relationship is maintained, and both the indexed and associative arrays apply
||corresponding reverse order and Rsort Arsort Krsort
||Use a function to compare a usort uksort uasort a function with a comparison that returns a value that is equal to or less than 0 when the first argument is equal to less than the second argument only takes the whole number of points
The example of this article is only a demonstration of ksort usage, interested readers can test the results of sort and asort, in order to deepen the impression, firmly grasp. I hope this example will help you with PHP program design.