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