PHP - Fonction Ds Set capacity ()

La fonction Ds \ Set :: capacity () peut renvoyer la capacité actuelle.

Syntaxe

public int Ds\Set::capacity( void )

La fonction Ds \ Set :: capacity () n'a aucun paramètre.

Exemple 1

<?php  
   $set = new \Ds\Set(); 
   echo("The default size of a set: ");  
   var_dump($set->capacity());  
  
   $set->allocate(100);  
   echo("The allocated size of a set: ");  
   var_dump($set->capacity());  
?>

Exemple 2

<?php  
   $set = new \Ds\Set([1, 2, 3, 4, 5, 6, 7]);  
   echo("The elements in a set: \n");  
   var_dump($set);  
  
   echo("\n The capacity of a set:");  
   var_dump($set->capacity());  
?>