The Ds\Queue::allocate() Function in PHP is used to allocate memory for a Queue class instance. This function allocates sufficient memory for a given capacity for an instance of Queue class.
void public Ds\Queue::allocate ( int $capacity )
Parameters: This function accepts a single parameter $capacity which is an integral value denoting the number of values for which capacity is needed to be allocated.
Return Value: This method does not returns any value.
Below programs illustrate the Ds\Queue::allocate() function in PHP:
Allocated Space is: int(8) Allocated space is: int(64)
Allocated Space is: int(8) Allocated space is: int(8) int(128)
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.