PHP | Ds\Stack capacity() Function Last Updated : 30 Jul, 2019 Comments Improve Suggest changes Like Article Like Report 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 programs illustrate the Ds\Stack::capacity() function in PHP: Program 1: php <?php // Declare new Stack $stack = new \Ds\Stack(); // Use capacity() function to check // the current capacity var_dump($stack->capacity()); ?> Output: int(8) Program 2: php <?php // Declare new Stack $stack = new \Ds\Stack(); echo("Current Capacity is: "); // Use capacity() function // to check the current capacity var_dump($stack->capacity()); echo("Current Capacity is: "); // Use allocate() function to // allocate capacity $stack->allocate(5); // Display the allocated vector // capacity var_dump($stack->capacity()); echo("Current Capacity is: "); // Use allocate() function to // allocate capacity $stack->allocate(120); // Display the allocated vector // capacity var_dump($stack->capacity()); ?> Output: Current Capacity is: int(8) Current Capacity is: int(8) Current Capacity is: int(120) Reference: https://www.php.net/manual/en/ds-stack.capacity.php Comment More infoAdvertise with us Next Article PHP | DsDeque capacity() Function jit_t Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-ds_stack 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 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 | DsStack copy() Function The Ds\Stack::copy() function of PHP Ds\Stack class is used to create a shallow copy of the original stack and returns the copied stack. Syntax: Ds\Stack public Ds\Stack::copy ( void ) Parameters: This function does not accept any parameters.Return Value: This function returns a shallow copy of the 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 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 Like