Sort (): Simple sorting of an array element from low to high, this function can be arranged numerically or alphabetically.
Listing A
$data = array(5,8,1,7,2); sort($data); print_r($data);?>输出结果如下所示:Array ([0] => 1[1] => 2[2] => 5[3] => 7[4] => 8)
Rsort (): An array of elements are inverted from high to low, and can be arranged numerically or alphabetically.
$data = array(5,8,1,7,2);rsort($data); print_r($data);?>它的输出结果如下:Array ([0] => 8[1] => 7[2] => 5[3] => 2[4] => 1)
Ksort (): a function that sorts according to a keyword, while maintaining the relevance of the keyword during sorting.
$data = array("US" => "United States", "IN" => "India", "DE" => "Germany", "ES" => "Spain"); ksort($data); print_r($data);?>它的输出结果如下:Array ([DE] => Germany[ES] => Spain[IN] => India[US] => United States)
Krsort (): An array of keywords is inverted according to the keyword.
$data = array("US" => "United States", "IN" => "India", "DE" => "Germany", "ES" => "Spain"); krsort($data); print_r($data);?>它的输出结果如下:Array ([US] => United States[IN] => India[ES] => Spain[DE] => Germany)
Asort (): Use value sorting to replace keyword ordering, note that the link between the keyword-value is always maintained.
$data = array("US" => "United States", "IN" => "India", "DE" => "Germany", "ES" => "Spain"); asort($data); print_r($data);?>它的输出结果如下:Array ([DE] => Germany[IN] => India[ES] => Spain[US] => United States)
Arsort (): Inverted alphabetically by value.
$data = array("US" => "United States", "IN" => "India", "DE" => "Germany", "ES" => "Spain"); arsort($data); print_r($data);?>Array ([US] => United States[ES] => Spain[IN] => India[DE] => Germany)
'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
'). Text (i)); }; $numbering. FadeIn (1700); }); });
The above describes the PHP sorting function, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.