Change language

PHP Ds / Vector allocate () function

Syntax:
void public DsVector::allocate ($capacity)
Parameters: This function takes one parameter $Capacity,which contains the space to be allocated.Note:The capacity will remain the same if this value is less than or equal to the current capacity.Returned value:this function does not return any value.The programs below illustrate the Ds / Vector::allocate function()in PHP:Program 1:  
// Declare a new vector $vector = new DsVector ( ); echo ( " Allocated Space is: " );  
// Using the Capacity() function var_dump ( $vector -> capacity()); echo ( " Allocated space is: " );  
// Use the allocate() function for
// share power $vector -> allocate (50);  
// Show selected vector
// capacity var_dump ( $vector -> capacity());  
?>
Output:
Allocated Space is: int (8) Allocated space is: int (50)
Program 2:  
// Declare a new vector $vector = new DsVector(); echo ( " Allocated Space is: " );  
// Using the Capacity() function var_dump ( $vector -> capacity()); echo ( " Allocated space is: " );  
// Use the allocate() function for
// share power $vector -> allocate (5);  
// Display the capacity of the vector var_dump ( $vector -> capacity());  
// Use the allocate() function for
// share power $vector -> allocate (120);  
// Display the capacity of the vector var_dump ( $vector -> capacity()); ?>
Output:
Allocated Space is: int (8) Allocated space is: int (8) int (120)
Link: http://php.net/manual/en/ds-vector.allocate.php

Shop

Learn programming in R: courses

$

Best Python online courses for 2022

$

Best laptop for Fortnite

$

Best laptop for Excel

$

Best laptop for Solidworks

$

Best laptop for Roblox

$

Best computer for crypto mining

$

Best laptop for Sims 4

$

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers


Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method