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

Ds\Set::capacity

PHP function Edit on GitHub ✎

(PECL ds >= 1.0.0)

Returns the current capacity

Description

Ds\Set::capacity(): int

Returns the current capacity.

Parameters Parameters

Return Values

The current capacity.

Examples

Ds\Set::capacity() example

php
<?php
$set = new \Ds\Set();
var_dump($set->capacity());

$set->add(...range(1, 50));
var_dump($set->capacity());
?>

The above example will output something similar to:

output
int(16)
int(64)

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