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 illustrate the Ds\Queue::capacity() function in PHP:
Program 1:
PHP
<?php
$q = new \Ds\Queue();
var_dump( $q ->capacity());
?>
|
Program 2:
PHP
<?php
$q = new \Ds\Queue();
echo ( "Current Capacity is: " );
var_dump( $q ->capacity());
echo ( "Current Capacity is: " );
$q ->allocate(5);
var_dump( $q ->capacity());
$q ->allocate(120);
var_dump( $q ->capacity());
?>
|
Output:
Current Capacity is: int(8)
Current Capacity is: int(8)
int(128)
Reference: http://php.net/manual/en/ds-queue.capacity.php
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!