PHP | Ds\Vector contains() Function Last Updated : 22 Aug, 2019 Comments Improve Suggest changes Like Article Like Report The Ds\Vector::contains() function is an inbuilt function in PHP which is used to check the vector contains given value or not. Syntax: bool public Ds\Vector::contains( $values ) Parameters: This function accepts a single parameter $values which contains single/many values. Return Value: This function returns true if the given value exists, false otherwise. Below programs illustrate the Ds\Vector::contains() function in PHP: Program 1: PHP <?php // Create a vector $vector = new \Ds\Vector([1, 2, 3, 4, 5]); // Use contains() function to check // existence of vector elements var_dump($vector->contains(1)); var_dump($vector->contains(1, 2)); var_dump($vector->contains(10)); ?> Output: bool(true) bool(true) bool(false) Program 2: PHP <?php // Create a vector $vector = new \Ds\Vector(["geeks", "for", "geeks"]); // Use contains() function to check // existence of vector elements var_dump($vector->contains("geeks")); var_dump($vector->contains("geeks", "for")); var_dump($vector->contains("GfG")); ?> Output: bool(true) bool(true) bool(false) Reference: http://php.net/manual/en/ds-vector.contains.php Comment More infoAdvertise with us Next Article PHP SplObjectStorage contains() Function B barykrg Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-ds_vector Similar Reads PHP str_contains() Function The str_contains() is a predefined function that is introduced with the release of PHP 8. The str_contains() function search for the substring in the given string within the expression. If the substring mentioned will be present in the string then it will return True otherwise it will return False. 2 min read PHP | DsSet contains() Function The Ds\Set::contains() function is an inbuilt function in PHP which is used to check the given value exists in the set or not. This function compares the value and its type. Syntax: bool public Ds\Set::contains( $values ) Parameters: This function accepts a single or many values which need to check 1 min read PHP | DsDeque contains() Function The Ds\Deque::contains() function is an inbuilt function in PHP which is used to check the deque contains given values or not. Syntax: bool Ds\Deque::contains( $values ) Parameters: This function accepts single or many $values which hold the value to check that value exist in the deque or not. Retur 1 min read PHP | DsVector contains() Function The Ds\Vector::contains() function is an inbuilt function in PHP which is used to check the vector contains given value or not. Syntax: bool public Ds\Vector::contains( $values ) Parameters: This function accepts a single parameter $values which contains single/many values. Return Value: This functi 1 min read PHP SplObjectStorage contains() Function The SplObjectStorage::contains() function is an inbuilt function in PHP which is used to check the storage object contains a specified object or not. Syntax: bool SplObjectStorage::contains( $value ) Parameters: This function accepts a single parameter $value which specifies the storage object which 1 min read PHP | DsSequence contains() Function The Ds\Sequence::contains() function is an inbuilt function in PHP which is used to check the given value exists in the sequence or not. Syntax: bool abstract public Ds\Sequence::contains ([ mixed $...values ] ) Parameter: This function accepts single or many values which need to check the value exi 1 min read PHPUnit | assertContains() function The assertContains() function is a builtin function in PHPUnit and is used to assert an array having a value. This assertion will return true in the case if the array contains the provided value else return false and in case of true the asserted test case got passed else test case got failed. Syntax 2 min read PHP | DsDeque count() Function The Ds\Deque::count() function is an inbuilt function in PHP which is used to get the number of elements in the Deque. Syntax: public Ds\Deque::count( void ) : int Parameters: This function does not accept any parameter. Return Value: This function returns the number of elements in the Deque. Below 1 min read PHP | DsVector count() Function The Ds\Vector::count() function is an inbuilt function in PHP which is used to count the number of elements in the vector. Syntax: int public Ds\Vector::count( void ) Parameters: This function does not accepts any parameter. Return Value: This function returns the number of elements in the vector. B 1 min read PHP | DsCollection toArray() Function The Ds\Collection::toArray() function is an inbuilt function in PHP which is used to converts the collections into array. Syntax: public Ds\Collection::toArray( void ) : array Parameters: This function does not accepts any parameters. Return Value: This function returns an array containing all colle 1 min read Like