PHP | Ds\Set capacity() Function Last Updated : 22 Aug, 2019 Comments Improve Suggest changes Like Article Like Report The Ds\Set::capacity() function is an inbuilt function in PHP which is used to return the capacity of the set. Syntax: int public Ds\Set::capacity( void ) Parameter: This function does not accepts any parameter. Return value: This function returns the current capacity of set. Below programs illustrate the Ds\Set::capacity() function in PHP: Program 1: php <?php // Declare an empty set $set = new \Ds\Set(); echo("Default size of Set: "); // Display the current capacity var_dump($set->capacity()); // Allocating space for 50 values $set->allocate(50); echo("Allocated size of Set: "); // Display the current capacity var_dump($set->capacity()); ?> Output: Default size of Set: int(8) Allocated size of Set: int(64) Program 2: php <?php // Declare a set $set = new \Ds\Set([1, 2, 3, 4, 5, 6]); echo("Elements of Set\n"); // Display the Set elements var_dump($set); echo("\nCapacity of Set: "); // Display the capacity of Set var_dump($set->capacity()); ?> Output: Elements of Set object(Ds\Set)#1 (6) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> int(4) [4]=> int(5) [5]=> int(6) } Capacity of Set: int(8) Reference: http://php.net/manual/en/ds-set.capacity.php Comment More infoAdvertise with us Next Article PHP | DsStack capacity() Function jit_t Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-ds_set Similar Reads PHP | DsSet capacity() Function The Ds\Set::capacity() function is an inbuilt function in PHP which is used to return the capacity of the set. Syntax: int public Ds\Set::capacity( void ) Parameter: This function does not accepts any parameter. Return value: This function returns the current capacity of set. Below programs illustra 1 min read PHP | DsStack capacity() Function The Ds\Stack::capacity() function is an inbuilt function in PHP which is used to return the current capacity of the stack. Syntax: int Ds\Stack::capacity( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the current capacity of the stack. Below pro 1 min read PHP | DsDeque capacity() Function The Ds\Deque::capacity() function is an inbuilt function in PHP which is used to get the current capacity of the Deque. Syntax: public Ds\Deque::capacity( void ) : int Parameters: This function does not accepts any parameter. Return Value: This function returns the current capacity of the Deque. Bel 1 min read PHP DsQueue capacity() Function The Ds\Queue::capacity() Function in PHP is used to check the current capacity of a Queue instance. Syntax: int public Ds\Queue::capacity ( void ) Parameters: This function does not accepts any parameters. Return Value: This function returns the current capacity of the Queue instance. Below programs 1 min read PHP | DsVector capacity() Function The Ds\Vector::capacity() function is an inbuilt function in PHP which is used to return the current capacity of the vector. Syntax: int public Ds\Vector::capacity( void ) Parameters: This function does not accept any parameter. Return Value: This function returns the current capacity of vector. Bel 1 min read PHP | DsSequence capacity() Function The Ds\Sequence::capacity() function is an inbuilt function in PHP which is used to returns the current capacity of sequence. Syntax: int abstract public Ds\Sequence::capacity ( void ) Parameter: This function does not accepts any parameter. Return value: This function returns the current capacity o 1 min read PHP | DsSet copy() Function The Ds\Set::copy() function is an inbuilt function in PHP which is used to returns the copy of the set element. Syntax: Ds\Set public Ds\Set::copy( void ) Parameter: This function does not contains any parameter. Return value: It returns the copy of set elements. Below programs illustrate the Ds\Set 1 min read PHP DsPriorityQueue capacity() Function The Ds\PriorityQueue::capacity() Function in PHP is used to check the current capacity of a PriorityQueue instance. Syntax: int public Ds\PriorityQueue::capacity ( void ) Parameters: This function does not accepts any parameters. Return Value: This function returns the current capacity of the Priori 1 min read PHP | DsDeque set() Function The Ds\Deque::set() function is an inbuilt function in PHP which is used to set the value at the given index in the Deque. Syntax: public Ds\Deque::set( $index, $value ) : void Parameters: This function accept two parameters as mentioned above and described below: index: This parameter holds the ind 2 min read PHP | DsVector set() Function The Ds\Vector::set() function is an inbuilt function in PHP which is used to set the value in the vector at the given index. Syntax: void public Ds\Vector::set( $index, $value ) Parameters: This function accepts two parameters as mentioned above and described below: $index: This parameter holds the 2 min read Like