PHP | Ds\Vector find() Function Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The Ds\Vector::find() function is an inbuilt function in PHP which is used to find the index of the element in the vector. Syntax: mixed public Ds\Vector::find( $value ) Parameters: This function accepts a single parameter $value which need to find the index value. Return Value: This function returns the index of the element in the vector on success or false on failure. Below programs illustrate the Ds\Vector::find() function in PHP: Program 1: PHP <?php // Declare a Vector elements $vector = new \Ds\Vector([1, 2, 3, 4, 5]); // Display the vector elements var_dump($vector); // Use find() function to find // the index value of element var_dump($vector->find(1)); var_dump($vector->find(5)); var_dump($vector->find(8)); var_dump($vector->find("Geeks")); ?> Output: object(Ds\Vector)#1 (5) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> int(4) [4]=> int(5) } int(0) int(4) bool(false) bool(false) Program 2: PHP <?php // Declare a Vector elements $vector = new \Ds\Vector(["Geeks", "for", "Geek", 1, "1", 0, "0"]); // Use find() function to find // the index value of element var_dump($vector->find(1)); var_dump($vector->find("0")); var_dump($vector->find(8)); var_dump($vector->find("Geeks")); ?> Output: int(3) int(6) bool(false) int(0) Reference: https://www.php.net/manual/en/ds-vector.find.php Comment More infoAdvertise with us Next Article PHP | DsDeque set() Function B barykrg Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-ds_vector Similar Reads PHP | DsDeque find() Function The Ds\Deque::find() function is an inbuilt function in PHP which is used to find the index of the element in the Deque if element found in the Deque.Syntax: public Ds\Deque::find( $value ) : mixed Parameters: This function accepts single parameter $value which holds the element whose index is to be 2 min read PHP | DsVector find() Function The Ds\Vector::find() function is an inbuilt function in PHP which is used to find the index of the element in the vector. Syntax: mixed public Ds\Vector::find( $value ) Parameters: This function accepts a single parameter $value which need to find the index value. Return Value: This function return 1 min read PHP | DsDeque set() Function The Ds\Deque::set() function is an inbuilt function in PHP which is used to set the value at the given index in the Deque. Syntax: public Ds\Deque::set( $index, $value ) : void Parameters: This function accept two parameters as mentioned above and described below: index: This parameter holds the ind 2 min read PHP | DsSequence find() Function The Ds\Sequence::find() function is an inbuilt function in PHP which is used to find the value from the sequence. If the value present in the sequence then return its index value otherwise return false. Syntax: mixed abstract public Ds\Sequence::find ( mixed $value ) Parameter: This function accepts 1 min read PHP | DsSet xor() Function The Ds\Set::xor() function is an inbuilt function in PHP which is used to create a new set which contains the value either in the first set or second set but not both. Syntax: Ds\Set public Ds\Set::xor ( Ds\Set $set ) Parameters: This function accepts a single parameter $set which is used to hold th 2 min read PHP | DsMap reverse() Function The Ds/Map::reverse() function in PHP is used to in-place reverse the elements of a specified Map instance. That is, the function in-place reverses the order of elements present in the specified Map instance. Syntax: Ds\Map public Ds\Map::reverse ( int $position ) Parameter: This function does not a 2 min read PHP | Ds\Vector find() Function min read Like