PHP | Ds\Vector allocate() Function
The Ds\Vector::allocate() function is an inbuilt function in PHP which is used to allocate enough memory for a required capacity. It provides the custom size of the vector to allocate space.
void public Ds\Vector::allocate( $capacity )
Parameters: This function accepts a single parameter $capacity which holds the space to be allocated.
Note: Capacity will remain the same if this value is less than or equal to the current capacity.
Return Value: This function does not return any value.
Below programs illustrate the Ds\Vector::allocate() function in PHP:
Allocated Space is: int(8) Allocated space is: int(50)
Allocated Space is: int(8) Allocated space is: int(8) int(120)