The Ds\Vector::get() function is an inbuilt function in PHP which is used to return the element at the given index.
mixed public Ds\Vector::get( $index )
Parameters: This function accepts a single parameter $index which contains the index (0-based indexing) at which the element is to be returned.
Return Value: This function returns the element at given index in the vector.
Exception: This function returns OutOfRangeException if the index is not valid.
Below programs illustrate the Ds\Vector::get() function in PHP:
int(4) int(2) int(5)
string(5) "geeks" string(3) "for" string(5) "geeks"
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.