php8.5
Home/ Manual/ ds / set/ Ds\Set::reverse

Ds\Set::reverse

PHP function Edit on GitHub ✎

(PECL ds >= 1.0.0)

Reverses the set in-place

Description

Ds\Set::reverse(): void

Reverses the set in-place.

Parameters Parameters

Return Values

Void

Examples

Ds\Set::reverse() example

php
<?php
$set = new \Ds\Set(["a", "b", "c"]);
$set->reverse();

print_r($set);
?>

The above example will output something similar to:

output
Ds\Set Object
(
    [0] => c
    [1] => b
    [2] => a
)

Source: reference/ds/ds/set/reverse.xml · from the official PHP manual (php/doc-en)