The Ds\Vector::insert() function is an inbuilt function in PHP which is used to insert the element into the vector at the given index.
void public Ds\Vector::insert( $index, $values )
Parameters: This function accepts two parameter as mentioned above and described below:
- $index: This parameter holds the index at which element is to be inserted.
- $value: This parameter holds the value which is to be inserted.
Return Value: This function does not return any value.
Exception: This function returns OutOfRangeException if the index is not valid.
Below programs illustrate the Ds\Vector::insert() function in PHP:
Ds\Vector Object (  => 1  => 2  => 4  => 5 ) Ds\Vector Object (  => 1  => 2  => 3  => 4  => 5 )
Ds\Vector Object (  => geeks  => for  => geeks ) Ds\Vector Object (  => geeks  => practice  => for  => geeks )
- PHP | Ds\Deque insert() Function
- PHP | Ds\Sequence insert() Function
- Program to Insert new item in array on any position in PHP
- Insert string at specified position in PHP
- How to insert an item at the beginning of an array in PHP ?
- D3.js selection.insert() Function
- Java Servlet and JDBC Example | Insert data in MySQL
- How to insert line break before an element using CSS?
- How to insert new row at a certain index in a table in jQuery ?
- How to insert spaces/tabs in text using HTML/CSS?
- How to insert HTML content into an iFrame using jQuery?
- How to insert HTML into view from AngularJS controller?
- How to insert text into the textarea at the current cursor position?
- How to insert a video link within an image file?
- How to insert a whole folder in New Google Sites ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.