Php arsort
From w3cyberlearnings
Contents |
PHP function arsort
This function sorts array in reverse order by using the array's values.
Syntax arsort
- array: array input
arsort(array);
Note
For function sorts without reverse order uses asort() function.
Example 1
<?php $country = array( 'USA' => 80, 'CHINA' => 61, 'VIETNAME' => 434, 'INDIA' => 135 ); arsort($country); print_r($country); ?>
Output
Array ( [VIETNAME] => 434 [INDIA] => 135 [USA] => 80 [CHINA] => 61 )
Related Links
- array_change_key_case
- array_chunk
- array_combine
- array_count_values
- array_diff_assoc
- array_diff_key
- array_diff_uassoc
- array_diff_ukey
- array_diff
- array_fill_keys
- array_fill
- array_filter
- array_flip
- array_intersect_assoc
- array_intersect_key
- array_intersect_uassoc
- array_intersect_ukey
- array_intersect
- array_key_ exists
- array_keys