The arsort function sorts an array by keys in descending order.


    $capitals = array('New York' => 'Albany', 'Texas' => 'Austin', 'Florida' => 'Tallahassee');

    arsort($capitals);

    print_r($capitals);
    // Array (
    //    [Florida] => Tallahassee
    //    [Texas] => Austin
    //    [New York] => Albany
    // )