• PHP Video Tutorials

PHP - Ds Set capacity() Function



Ds\Set::capacity() function can return the current capacity.

Syntax

public int Ds\Set::capacity( void )

Ds\Set::capacity() function doesn't have any parameters.

Example 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());  
?>

Example 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());  
?>
php_function_reference.htm
Advertisements