PHP | Ds\Sequence capacity() Function Last Updated : 21 Aug, 2019 Comments Improve Suggest changes Like Article Like Report 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 of sequence. Below programs illustrate the Ds\Sequence::capacity() function in PHP: Program 1: php <?php // Declare a sequence $seq = new \Ds\Vector(); // Use capacity() function var_dump($seq->capacity()); // Push element in sequence $seq->push(...range(1, 100)); // Use capacity() function var_dump($seq->capacity()); // Pop element in sequence $seq->pop(); // Use capacity() function var_dump($seq->capacity()); ?> Output: int(8) int(100) int(100) Program 2: php <?php // Declare a sequence $seq = new \Ds\Vector(); // Push element in sequence $seq->push(...range(1, 50)); // Use capacity() function var_dump($seq->capacity()); // Push element in sequence $seq->push(...range(1, 50)); // Use capacity() function var_dump($seq->capacity()); ?> Output: int(50) int(100) Reference: https://www.php.net/manual/en/ds-sequence.capacity.php Comment More infoAdvertise with us Next Article PHP DsSet Functions Complete Reference R R_Raj Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-ds_sequence 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 | 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 | 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 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 Functions Complete Reference Set is the collection of unique values. The implementation of Ds\Set is similar to the Ds\Map which creates a hash table. The values of Ds\Set are used as key and the mapped values are ignored. Requirements: PHP 7 is required for both extension and the compatibility polyfill. Installation: The easie 2 min read PHP DsMap Functions Complete Reference A Map is a sequential collection of key-value pair which is very similar to the array. The key of a map can be of any type and it is unique. If any value added to the same key in a Map then the map value will replace. It is the efficient Data Structure in PHP 7 to provide the alternative of an array 3 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 | DsSet reduce() Function The Ds\Set::reduce() function is an inbuilt function in PHP which is used to reduce the set to a single value by applying operations using the callback function. Syntax: mixed public Ds\Set::reduce ( callable $callback [, mixed $initial ] ) Parameters: This function accepts two parameters as mention 2 min read Like