PHP 버전
4+
$products = [
    '사과' => 3000,
    '바나나' => 1000,
    '체리' => 5000
];

// 값 기준 내림차순으로 정렬
arsort($products);

// 결과 출력
print_r($products);
출력
$countries = [
    'US' => 'United States',
    'KR' => 'Korea',
    'JP' => 'Japan',
    'FR' => 'France',
    'AU' => 'Australia'
];

// 국가명 기준 내림차순으로 정렬
arsort($countries);

// 결과 출력
print_r($countries);
출력
// PHP 8.2.0 전
arsort(array &$array, int $flags = SORT_REGULAR): true

// PHP 8.2.0부터
arsort(array &$array, int $flags = SORT_REGULAR): bool
$items_1 = [
    'a' => 12,
    'b' => 'abc',
    'c' => '15',
    'd' => 7,
    'e' => 'Banana'
];

arsort($items_1, SORT_NUMERIC);
// 숫자 기준 내림차순 정렬 (SORT_NUMERIC)
// 배열의 모든 값(value)을 숫자로 간주하여 비교합니다.
// 숫자로 변환할 수 있는 문자열('15')은 해당 숫자로 취급되어 앞쪽에 위치합니다.
// 숫자로 변환할 수 없는 문자열('abc', 'Banana')은 0으로 취급되어
// 내림차순 정렬 시 뒤쪽에 위치합니다.

var_dump($items_1);
/*
array(5) {
  ["c"]=> string(2) "15"     // 문자열 '15' → 숫자 15로 변환
  ["a"]=> int(12)            // 숫자 12
  ["d"]=> int(7)             // 숫자 7
  ["b"]=> string(3) "abc"    // 숫자로 변환 불가 → 0 취급
  ["e"]=> string(6) "Banana" // 숫자로 변환 불가 → 0 취급
}
*/

////////////////////

$items_2 = [
    'a' => 12,
    'b' => 'abc',
    'c' => '15',
    'd' => 7,
    'e' => 'Banana'
];

arsort($items_2, SORT_STRING);
// 문자열 기준 내림차순 정렬 (SORT_STRING)
// 배열의 모든 값(value)을 문자열로 간주하여
// 문자열 바이트 값 기준의 사전식(lexicographical) 내림차순으로 정렬합니다.
// 키(key)와 값(value)의 관계는 유지됩니다.

var_dump($items_2);
/*
array(5) {
  ["b"]=> string(3) "abc"      // 'a'(97)
  ["e"]=> string(6) "Banana"   // 'B'(66)
  ["d"]=> int(7)               // '7'
  ["c"]=> string(2) "15"       // '15'
  ["a"]=> int(12)              // '12'
}
*/