Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Sort an array in descending order
<?php rsort(array &$array, int $flags = SORT_REGULAR): true
<?php                     : ksort($array, $options);

        } else {

            $descending

                    ? rsort($array, $options)

                    : sort($array, $options);

        }
<?php         $data = $data->sortBy(['item']);

        $this->assertEquals($data->pluck('item')->toArray(), $expected);



        rsort($expected);

        $data = $data->sortBy([['item', 'desc']]);

        $this->assertEquals($data->pluck('item')->toArray(), $expected);
<?php         $data = $data->sortBy(['item'], SORT_STRING);

        $this->assertEquals($data->pluck('item')->toArray(), $expected);



        rsort($expected, SORT_STRING);

        $data = $data->sortBy([['item', 'desc']], SORT_STRING);

        $this->assertEquals($data->pluck('item')->toArray(), $expected);
<?php         $data = $data->sortBy(['item'], SORT_NUMERIC);

        $this->assertEquals($data->pluck('item')->toArray(), $expected);



        rsort($expected, SORT_NUMERIC);

        $data = $data->sortBy([['item', 'desc']], SORT_NUMERIC);

        $this->assertEquals($data->pluck('item')->toArray(), $expected);