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 PriorityQueue instance.
Below programs illustrate the Ds\PriorityQueue::capacity() Function in PHP:
Program 1:
<?php // Declare new PriorityQueue $pq = new \Ds\PriorityQueue(); // Use capacity() function // to check the current capacity var_dump($pq->capacity()); ?> |
int(8)
Program 2:
<?php // Declare new PriorityQueue $pq = new \Ds\PriorityQueue(); echo("Current Capacity is: "); // Use capacity() function // to check the current capacity var_dump($pq->capacity()); echo("Current Capacity is: "); // Use allocate() function to // allocate capacity $pq->allocate(5); // Display the allocated vector // capacity var_dump($pq->capacity()); // Use allocate() function to // allocate capacity $pq->allocate(120); // Display the allocated vector // capacity var_dump($pq->capacity()); ?> |
Current Capacity is: int(8) Current Capacity is: int(8) int(128)
Reference: http://php.net/manual/en/ds-priorityqueue.capacity.php
Recommended Posts:
- PHP | Ds\Set capacity() Function
- PHP | Ds\Deque capacity() Function
- PHP | Ds\Vector capacity() Function
- PHP | Ds\Sequence capacity() Function
- PHP | Ds\Map capacity() Function
- PHP | Ds\Stack capacity() Function
- PHP Ds\Queue capacity() Function
- How to get the function name inside a function in PHP ?
- PHP 5 vs PHP 7
- PHP | Get PHP configuration information using phpinfo()
- PHP | php.ini File Configuration
- How to import config.php file in a PHP script ?
- PHP | imagecreatetruecolor() Function
- PHP | fpassthru( ) Function
- PHP | ImagickDraw getTextAlignment() Function
- PHP | Ds\Sequence last() Function
- PHP | Imagick floodFillPaintImage() Function
- Function to escape regex patterns before applied in PHP
- PHP | array_udiff_uassoc() Function
- PHP | geoip_continent_code_by_name() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

