PHP | Ds\Deque capacity() Function Last Updated : 14 Aug, 2019 Comments Improve Suggest changes Like Article Like Report 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. Below programs illustrate the Ds\Deque::capacity() function in PHP: Program 1: PHP <?php // Allocating deque of default size $deck = new \Ds\Deque(); echo("Default size of Deque: "); // Display the current capacity of the deque var_dump($deck->capacity()); // Allocating space for 50 values to the deque $deck->allocate(50); echo("Allocated size of Deque: "); // Display the current capacity of the deque var_dump($deck->capacity()); ?> Output: Default size of Deque: int(8) Allocated size of Deque: int(64) Program 2: PHP <?php // Declare Deque $deck = new \Ds\Deque([1, 2, 3, 4, 5, 6]); echo("Elements of Deque\n"); // Display the Deque elements var_dump($deck); echo("\nCapacity of Deque: "); // Display the capacity of Deque var_dump($deck->capacity()); ?> Output: Elements of Deque object(Ds\Deque)#1 (6) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> int(4) [4]=> int(5) [5]=> int(6) } Capacity of Deque: int(8) Reference: http://php.net/manual/en/ds-deque.capacity.php Comment More infoAdvertise with us Next Article PHP DsQueue capacity() Function B barykrg Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-ds_map Similar Reads 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 | 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 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 | 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 | DsDeque copy() Function The Ds\Deque::copy() function is an inbuilt function in PHP which is used to return a copy of the Deque. This will return a shallow copy of the Deque. Syntax: public Ds\Deque::copy ( void ) : Ds\Deque Parameters: This function does not contain any parameter. Return Value: This function returns a cop 2 min read PHP | DsDeque apply() Function The Ds\Deque::apply() function is an inbuilt function in PHP which is used to update the values of Deque by performing operations as defined by the callback function. Syntax: public Ds\Deque::apply( $callback ) : void Parameters: This function accepts single parameter $callback which holds the funct 2 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 DsQueue copy() Function The Ds\Queue::copy() Function in PHP is used to create a shallow copy of a particular Queue instance. This function does not affect the existing Queue instance, it just creates a shallow copy of the Queue and returns it. Syntax: Ds\Queue public Ds\Queue::copy ( void ) Parameters: This function does 1 min read Like