PHP | Ds\Sequence find() Function Last Updated : 21 Aug, 2019 Comments Improve Suggest changes Like Article Like Report 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 single parameter $value which need to check that it present in the sequence or not. Return value: This function returns the index of value on success or False on failure. Below programs illustrate the Ds\Sequence::find() function in PHP: Program 1: php <?php // Create new sequence $seq = new \Ds\Vector([21, 23, "p", "x"]); // Use find() function var_dump($seq->find("G")); // Use find() function var_dump($seq->find(21)); // Use find() function var_dump($seq->find(10)); // Use find() function var_dump($seq->find("x")); // Use find() function var_dump($seq->find("p")); ?> Output: bool(false) int(0) bool(false) int(3) int(2) Program 2: php <?php // Create new sequence $seq = new \Ds\Vector(["G", "E", "E", "K", "S", "1", "2", 1, 2, 3, 4]); // Use find() function var_dump($seq->find("G")); // Use find() function var_dump($seq->find(1)); // Use find() function var_dump($seq->find(10)); // Use find() function var_dump($seq->find("1")); // Use find() function var_dump($seq->find("k")); // Use find() function var_dump($seq->find("F")); // Use find() function var_dump($seq->find("4")); ?> Output: int(0) int(7) bool(false) int(5) bool(false) bool(false) bool(false) Reference: http://php.net/manual/en/ds-sequence.find.php Comment More infoAdvertise with us Next Article PHP | DsVector reduce() Function V vijay_raj Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-DS\Collection 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 slice() Function The Ds\Deque::slice() function is an inbuilt function in PHP which is used to return a sub-Deque which contains elements of the Deque within the index range. Syntax: public Ds\Deque::slice( $index, $length ) : Ds\Deque Parameters: This function accept two parameters as mentioned above and described 2 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 | DsSet slice() Function The Ds\Set::slice() function is an inbuilt function in PHP which is used to return the sub-set of given range. Syntax: Ds\Set public Ds\Set::slice ( int $index [, int $length ] ) Parameters: This function accepts two parameters as mentioned above and described below: $index: This parameter holds the 2 min read PHP | DsDeque sum() Function The Ds\Deque::sum() function is an inbuilt function in PHP which is used to return the sum of all elements present in the Deque. Syntax: public Ds\Deque::sum( void ) : number Parameters: This function does not accept any parameter. Return Value: This function returns the sum of all Deque elements. B 2 min read PHP | DsSequence reduce() Function The Ds\Sequence::reduce() function is an inbuilt function in PHP which is used to reduce the sequence to a single value using a callback function. Syntax: mixed abstract public Ds\Sequence::reduce ( callable $callback [, mixed $initial ] ) Parameters: This function accepts two parameters as mentione 2 min read PHP DsSet sum() Function The Ds\Set::sum() function of Ds\Set class in PHP is an inbuilt function which is used to find the sum of all of the elements present in a Set. Syntax: number public Ds\Set::sum ( void ) Parameter: This function does not accepts any parameter. Return Value: This function returns the sum of the value 1 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 | DsVector reduce() Function The Ds\Vector::reduce() function is an inbuilt function in PHP which reduce the vector to a single value by applying operations in the callback function. Syntax: mixed public Ds\Vector::reduce( $callback, $initial ) Parameters: This function accepts two parameters as mentioned above and described be 2 min read Like