Ds\Set::sort

Sorts the set in-place

&reftitle.description; public `void` `Ds\Set::sort` `callable` `comparator`

Sorts the set in-place, using an optional `comparator` function.

&reftitle.parameters;

`comparator`

- &sort.callback.description;
&reftitle.returnvalues;

&return.void;

&reftitle.examples;

### `Ds\Set::sort` example

    <?php
    $set = new \Ds\Set([4, 5, 1, 3, 2]);
    $set->sort();

    print_r($set);
    ?>

&example.outputs.similar;

    Ds\Set Object
    (
        [0] => 1
        [1] => 2
        [2] => 3
        [3] => 4
        [4] => 5
    )

### `Ds\Set::sort` example using a comparator

    <?php
    $set = new \Ds\Set([4, 5, 1, 3, 2]);

    $set->sort(function($a, $b) {
        return $b <=> $a;
    });

    print_r($set);
    ?>

&example.outputs.similar;

    Ds\Set Object
    (
        [0] => 5
        [1] => 4
        [2] => 3
        [3] => 2
        [4] => 1
    )