The Ds\Stack::allocate() function is an inbuilt function in PHP which is used to allocate memory for required capacity. This function allocates sufficient memory for a given capacity of an instance of Stack class.
void Ds\Stack::allocate( $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 allocate.
Return Value: This function does not return any value.
Below programs illustrate the Ds\Stack::allocate() function in PHP:
Allocated Space is: int(8) Allocated space is: int(50)
Allocated Space is: int(8) Allocated space is: int(8) Allocated space is: int(120)