Get The Most Affordable Hosting in the World!
Starting at just $1.87/month, Vercaa offers unbeatable pricing for world-class web hosting services.
Fast, reliable, and secure hosting to power your website without breaking the bank. Plus, enjoy a free CDN for faster loading times worldwide!
Get Started Now!The append() Method
The append() method adds a new element at the end of given array.
Syntax
Parameters
-
v − new value is added at the end of the array. The new value must be of the same type as datatype argument used while declaring array object.
Example
It will produce the following output −
array('i', [1, 2, 3, 10])
The insert() Method
The array class also defines insert() method. It is possible to insert a new element at the specified index.
Syntax
Parameters
-
i − The index at which new value is to be inserted.
-
v − The value to be inserted. Must be of the arraytype.
Example
It will produce the following output −
array('i', [1, 20, 2, 3])
The extend() Method
The extend() method in array class appends all the elements from another array of same typecode.
Syntax
Parameters
-
x − Object of array.array class
Example
It will produce the following output −
array('i', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
The End! should you have any inquiries, we encourage you to reach out to the Vercaa Support Center without hesitation.